﻿<script src="/Public/jsLibrary/jquery/jquery.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script src="/<?php echo $SystemConest[1];?>/system/ckeditor/ckeditor.js"></script>
<?php
require_once("UserFunction.php");//加载特定项目函数库


//请在 文件$dirname."/".$guanliDir."/UIFunction/adminClass.php";后引用

$MenuId=isset($_REQUEST["MenuId"])?$_REQUEST["MenuId"]:"";
	//获取表单列表配置
	function GetListConfig($mydb,$MenuId)
	{
	    if($MenuId=="") return "";
		global $SystemTablename;
		global $SystemConest;
		$result=$mydb->db_select_query("Select  ".$SystemTablename[2]."10 from ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."0=".$MenuId);
		$rs=$mydb->db_fetch_array($result);
		if($rs) return $rs[0];
	}
/**
 * 获取menuid所在的字段列号
 */
function getMenuidofFieldNum($mydb,$MenuId)
{
	global $SystemTablename;
	global $SystemConest;
	$tl="";
	$result=$mydb->db_select_query("select * from ".$SystemConest[7]."menusys where menusys0=".$MenuId);
	//die("select * from ".$SystemConest[7]."menusys where menusys0=".$MenuId);
	if($result)	$rs=$mydb->db_fetch_array($result);
	if($rs) $tl=$rs[7];
	if($tl!="")
	{
		$arr=explode(",", $tl);
		foreach($arr as $k=>$v)
		{
			if(strstr($v,"MenuId|")) return $k;
		}
	}
	return 0;

}

//显示一级栏目列表
function ShowMenu1List($MenuId)
{
$myclass=new  YYBDB();
global $SystemTablename;
global $SystemConest;

$sqlrs="Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=0  Order by ".$SystemTablename[2]."4 Asc";

$rsc=$myclass->db_select_query($sqlrs);
 	//$MenuId=$MenuId;
		?>
  <table width="99%" align="Left" border="0" cellspacing="1"  class="YKTtable">
  <tr  style="background-image:url(../../Iamges/Top_3_Line.jpg); color:#CCC" Height="25">
    <th width="7%"><div align="center">ID</div></th>
    <th width="15%"><div align="center">栏目名称[序号]</div></th>
    <th width="25%"><div align="center">系统名称</div></th>
    <th ><div align="center">系统入口</div></th>
    <th ><div align="center">操作</div></th>
  </tr>
		<?
		while($rs=$myclass->db_fetch_array($rsc))
		{
		?>
  <tr class="YKTtr" Height="25">
    <td><div align="center"><? echo $rs[0];?></div></td>
    <td>　<? echo $rs[1];?>[<? echo $rs[4]; ?>]　</td>
    <td><? echo $rs[5]; ?>　</td>
    <td><? echo $rs[2]; ?>　</td>
    <td ><div align="center"><a href="Add.php?MenuId=<? echo $MenuId; ?>&CurrMenuId=<? echo $rs[0];?>&Menu1Name=<? echo $rs[1];?>" class="Linktr12">添加二级栏目</a> | <a href="Update.php?MenuId=<? echo $MenuId;?>&CurrMenuId=<? echo $rs[0];?>&Menu1Name=<? echo $rs[1];?>" class="Linktr12">修改</a> | <a href="Delete.php?MenuId=<? echo $MenuId;?>&CurrMenuId=<? echo $rs[0];?>&Menu1Name=<? echo $rs[1];?>" class="Linktr12">删除</a></div></td>
  </tr>

<?
	//显示二级栏目列表
	ShowMenu2List($MenuId,$rs[0],$rs[1]);

	}

echo "</table>";

}


//显示二级栏目列表函数
function ShowMenu2List($MenuId,$Menu1id,$Menu1Name)
{
	//Sub ShowMenu2List(MenuId,Conn,Menu1Name)
		if(strlen($MenuId)<1)
			return;//退出
	$myclass=new  YYBDB();
	global $SystemConest;
	global $SystemTablename;
		$sqlrs2="Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=".$Menu1id." Order by ".$SystemTablename[2]."4 ASC";
 		$rsc2=$myclass->db_select_query($sqlrs2);

 while($rs2=$myclass->db_fetch_array($rsc2))
		{
			if(strlen($rs2[2])<1)
			{

?>
  <tr class="YKTtd" Height="25">
    <td><div align="center"><? echo $rs2[0];?></div></td>
    <td>　　<? echo $rs2[1];?>[<? echo $rs2[4];?>]　</td>
    <td>　</td>
    <td>　　</td>
    <td><div align="center"> <a href="Update.php?MenuId=<? echo $rs2[3];?>&CurrMenuId=<? echo $rs2[0];?>&Menu1Name=<? echo $Menu1Name;?>" class="Link12">修改</a> | <a href="Delete.php?MenuId=<? echo $rs2[3];?>&CurrMenuId=<? echo $rs2[0];?>&Menu1Name=<? echo $Menu1Name;?>" class="Link12">删除</a> | 设置 | 复制栏目 </div></td>
  </tr>

<? }
else
{

?>
  <tr class="YKTtd" Height="25">
    <td><div align="center"><? echo $rs2[0];?></div></td>
    <td>　　<? echo $rs2[1];?>[<? echo $rs2[4];?>]　</td>

    <td>　<? echo $rs2[5];?>　</td>
    <td>　<? echo $rs2[2];?>　</td>
    <td><div align="center"> <a href="Update.php?MenuId=<? echo $rs2[3];?>&CurrMenuId=<? echo  $rs2[0];?>&Menu1Name=<? echo $Menu1Name;?>" class="Link12">修改</a> | <a href="Delete.php?MenuId=<? echo $rs2[3];?>&CurrMenuId=<? echo  $rs2[0];?>&Menu1Name=<? echo $Menu1Name;?>" class="Link12">删除</a> |<a href="Config.php?CurrMenuId=<? echo  $rs2[0];?>&DBName=<? echo  $rs2[9];?>" class="Link12">设置</a> |<a href="CopyColumn.php?Id=<? echo  $rs2[0];?>" class="Link12">复制栏目</a> </div></td>
  </tr>
<?
  }
 }
}


//获得一级类别下是否有二级栏目
function GetMenu2Num($CurrMenuId)
{
	$mydb=new YYBDB();
	global $SystemTablename;
	global $SystemConest;
	$sqlrs="select * from ".$SystemConest[7].$SystemTablename[2]." where ".$SystemTablename[2]."3=".$CurrMenuId;
	$rs=$mydb->db_select_query($sqlrs);
	return  $mydb->db_num_rows($rs);

}

//生成表单配置
function CreateAllConfig($FieldCount)
{
		$sCreateAllConfig="";
		if($FieldCount==0)
			return "";
		for($i=0;$i<$FieldCount;$i++)
		{
			$sCreateAllConfig=$sCreateAllConfig . CreateConfig($i) . ",";
		}

		$sCreateAllConfig=substr($sCreateAllConfig,0,-1);


		return $sCreateAllConfig;
}

//生成表单配置
function CreateConfig($i)
{

		$TabelName=$_REQUEST["Name_".$i];
		$InputType=$_REQUEST["Input_" .$i];
		$ClassType=$_REQUEST["Class_" .$i];
		$Mark=$_REQUEST["Mark_" .$i];
		$Show=$_REQUEST["Show_".$i];
		$Check=$_REQUEST["Check_" .$i];


		$TabelName=str_replace(",","",$TabelName);
		$TabelName=str_replace("|","",$TabelName);

		$Mark=str_replace(",","，",$Mark);
		$Mark=str_replace("|","｜",$Mark);

		$Check=str_replace(",","",$Check);
		$Check=str_replace("|","",$Check);
		$sCreateConfig=$TabelName . "|" . $InputType . "|" . $ClassType . "|" . $Mark . "|" . $Show . "|" . $Check ;

		return $sCreateConfig;
}


//生成列表配置
function CreateInfoList()
{

		$InfoFieldList=$_REQUEST["FieldList"];
		$InfoFieldList=str_replace(",","",$InfoFieldList);

		$InfoAdd=$_REQUEST["checkbox1"];
		$InfoUpdate=$_REQUEST["checkbox2"];
		$InfoDelete=$_REQUEST["checkbox3"];
		$InfoShenHe=$_REQUEST["checkbox4"];
		$InfoListPage=$_REQUEST["checkbox5"];
		$InfoPageSize=$_REQUEST["PageSize"];
		$InfoPageSize=str_replace(",","",$InfoPageSize);
		$FieldsPaixu=$_REQUEST["FieldsPaixu"];
		$listPaixu=$_REQUEST["listPaixu"];
		$editgotourl=$_REQUEST["editgotourl"];
		if(is_numeric($InfoPageSize)==false)
			$InfoPageSize=10;
		$InfoTitle=$_REQUEST["InfoTitle"];
		$InfoTitle=str_replace(",","",$InfoTitle);

		$sCreateInfoList=$InfoFieldList . ",". $InfoAdd . "|" . $InfoUpdate . "|" . $InfoDelete . "|" .$InfoShenHe ."|". $InfoListPage . "," . $InfoPageSize . "," . $InfoTitle .",".$FieldsPaixu.",".$listPaixu.",".$editgotourl;


	return $sCreateInfoList;
}

//获取表单配置
function GetFormConfig($mydb,$MenuId)
{
		$sGetFormConfig="";
		if($MenuId=="")
			return "";
		global $SystemTablename;
		global $SystemConest;
		$sqlrs="Select  ".$SystemTablename[2]."7 from ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."0=" .$MenuId;
		$rsc=$mydb->db_select_query($sqlrs);
		$rs=$mydb->db_fetch_array($rsc);
		if($mydb->db_num_rows($rsc)>0)
			 return $rs[0];
		else
			return "";
}

	//获取表单配置表里的任意一字段的值
function GetFormConfigAnyOne($mydb,$MenuId,$field)
{
		//$field 为想要返回的字段序号或字段名称
		$sGetFormConfig="";
		if($MenuId=="")
			return "";
		global $SystemTablename;
		global $SystemConest;
		$sqlrs="Select  * from ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."0=" .$MenuId;
		$rsc=$mydb->db_select_query($sqlrs);
		$rs=$mydb->db_fetch_array($rsc);
		if($mydb->db_num_rows($rsc)>0)
			 return $rs[$field];
		else
			return "";
}

//获取字段元素数组排序
function getFieldsPaixuArr($mydb,$MenuId)
{
	$Fieldspaixu=GetFormConfigAnyOne($mydb,$MenuId,10);
	
	if(strlen($Fieldspaixu)>0)
	{
		$FieldsPArr=explode(",",$Fieldspaixu);
		$Fieldspaixu=$FieldsPArr[4];
			$FeildsArr=explode("/",$Fieldspaixu);
			return $FeildsArr;
	}
	else
	{
		return "";
	}
}




/*================================================
'   表单配置相关函数
'  --------------------------
'
'	'加载空白表单
'================================================
*/
function LoadBankForm($mydb,$DBName)
{
	    if($DBName=="") return "";
		global $SystemConest;
		$sqlrs="Select * from ".$SystemConest[7].$DBName." limit 1";

		$rsc=$mydb->db_select_query($sqlrs);
		$result=$mydb->db_query($sqlrs);
		$fieldsCount=$mydb->db_num_fields($result);
		?>
	  <input type="hidden" name="FieldCount"  value="<? echo $fieldsCount;?>"/>
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="YKTtable">
	  <tr>
		<td width="30" height="25" class="YKTth"><div align="center">序号</div></td>
		<td  height="25" class="YKTth"><div align="center">名称</div></td>
		<td width="79" height="25" class="YKTth"><div align="center">输入类型</div></td>
		<td width="50" height="25" class="YKTth"><div align="center">关联数据</div></td>
		<td  height="25" class="YKTth"><div align="center">说明</div></td>
		<td width="70" height="25" class="YKTth"><div align="center">字段名</div></td>
		<td width="50" height="25" class="YKTth"><div align="center">字段类型</div></td>
		<td width="40" height="25" class="YKTth"><div align="center">开/关</div></td>
		<td  height="25" class="YKTth"><div align="center">数据验证</div></td>
	  </tr>

		<?
		for($i=0;$i<$fieldsCount;$i++)
		{
			$Fields=$mydb->db_fetch_field($result);
			if($Fields->primary_key!=1)
			{
		?>

	  <tr onMouseOver = "this.style.backgroundColor = '#EEEEEE'" onMouseOut = "this.style.backgroundColor = ''">
		<td height="25" class="YKTtd"><div align="center"><? echo $i;?></Div></td>
		<td height="25" class="YKTtd"><label>
		  <div align="center">
			<input type="text" name="<? echo "Name_" . $i; ?>" value="" size="10"/>
		  </div>
		</label></td>
		<td height="25" class="YKTtd"><label>
		  <div align="center">
			<select name="<? echo "Input_" . $i; ?>" onchange="javascript:GetClassList(<? echo "Div_" . $i;?>,this.value,'<? echo "Class_". $i; ?>');" >
			  <option value="1"  >文本框</option>
			  <? if($Fields->type=="int")
			  	{ ?>
				  <option value="3" >单选框</option>
				  <option value="2" >下拉框</option>
				  <option value="9" >新建ID</option>
                   <option value="18" >列表属性</option>
			  <? }?>
			  <? if($Fields->type=="string" || $Fields->type=="blob")
			  	{
			   ?>
				  <option value="4" >复选框</option>
				  <option value="5" >上传框</option>
				  <option value="6" >编辑器</option>
				  <option value="10" >审核ID</option>
				  <option value="17" >文本域</option> <!-- { 审核状态（0/1）|审核人ID|审核时间 } -->
                  <option value="19" >模板文件</option>
                  <option value="20" >静态地址</option>
                   <option value="21" >单项多分</option>

			   <? }?>

			  <? if($Fields->type=="string" || $Fields->type=="blob"  || $Fields->type=="datetime")
			  	{ ?>
				  <option value="8" >日期值</option>
			   <? }?>


			  <option value="7" >隐藏值</option>
			  <option value="11" >栏目ID</option>
			  <option value="14" >主表ID</option>
			  <option value="15" >从表ID</option>
			  <option value="16" >密码框</option>
			</select>
		  </div>
		</label></td>
		<td height="25" class="YKTtd"><div align="center" id="<? echo "Div_" . $i;?>" date=""></div></td>
		<td height="25" class="YKTtd"><div align="center">
		  <input type="text" name="<? echo "Mark_" . $i; ?>"  value=""/>
		</div></td>
		<td height="25" class="YKTtd"><div align="center"><? echo $Fields->name;?></div></td>
		<td height="25" class="YKTtd"><div align="center"><? echo GetFieldType($Fields->type);?></div></td>
		<td height="25" class="YKTtd"><div align="center">
		  <select name="<? echo "Show_" . $i; ?>">
			<option value="1">关</option>
			<option value="0">开</option>
		  </select>
		</div></td>
		<td height="25" class="YKTtd"><div align="center">
		  <input type="text" name="<? echo "Check_" . $i; ?>"  value="" size="20"/>
		</div></td>
	    </tr>

		<?
			}
		}

	?>
</table>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="YKTtable">
  <tr>
    <td width="18%" class="YKTtd"><div align="right">显示的字段列表:</div></td>
    <td colspan="2" class="YKTtd"><input name="FieldList" type="text" id="FieldList" size="50">
      形式 字段1/宽度/对齐方式|字段n/宽度/对齐方式</td>
  </tr>
  <tr>
    <td class="YKTtd"><div align="right">功能列表:</div></td>
    <td width="47%" class="YKTtd"><label>
      <input name="checkbox1" type="checkbox"  value="1">
      添加
      <input type="checkbox" name="checkbox2" value="1">
      修改
      <input type="checkbox" name="checkbox3" value="1">
删除
<input type="checkbox" name="checkbox4" value="1">
审核
<input type="checkbox" name="checkbox5" value="1">
翻页</label></td>
    <td width="35%" class="YKTtd"><label>
      <input name="PageSize" type="text" id="PageSize" size="6" value="10">
    </label>
      条／页 *每页显示的记录条数 </td>
  </tr>
  <tr>
    <td class="YKTtd"><div align="right">在各页面显示的标题</div></td>
    <td colspan="2" class="YKTtd"><input name="InfoTitle" type="text" id="InfoTitle" size="50"></td>
  </tr>
  <tr><td height="21" align="right" class="YKTtd">字段排序:</td><td><span class="YKTtd">
    <input name="FieldsPaixu" type="text" id="FieldsPaixu" size="50"  value="" />
  </span></td>
  <td class="YKTtd">最前面的排在第一位如&ldquo;1/2/3/4/5&rdquo;不需要的可以不写</td></tr>
</table>

		  </p>
		<div align="center">
		  <label>
		  <input type="submit" name="Submit" value=" 保存 " />
		  <input type="button" name="Submit2" value="取消" onClick="javascript:window.history.back();"/>

		  </label>
		</div>
		<p>&nbsp;</p>
<?
}
//加载修改表单
function LoadUpdateForm($mydb,$MenuId,$arrFormConfig,$DBName)
{

     global $SystemConest;
	 global $SystemTablename;
	if($DBName=="") return "";
	$sqlrs="Select * from ".$SystemConest[7].$DBName." order by ".$DBName."0  limit 1";

	$rsc=$mydb->db_query($sqlrs);

	$fieldsCount=$mydb->db_num_fields($rsc);
	$i=0;

		?>
	  <input type="hidden" name="FieldCount"  value="<?php echo $fieldsCount;?>"/>
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="YKTtable">
	  <tr>
		<td width="30" height="25" class="YKTth"><div align="center">序号</div></td>
		<td  height="25" class="YKTth"><div align="center">名称</div></td>
		<td width="79" height="25" class="YKTth"><div align="center">输入类型</div></td>
		<td width="50" height="25" class="YKTth"><div align="center">关联数据</div></td>
		<td  height="25" class="YKTth"><div align="center">说明</div></td>
		<td width="70" height="25" class="YKTth"><div align="center">字段名</div></td>
		<td width="50" height="25" class="YKTth"><div align="center">字段类型</div></td>
		<td width="40" height="25" class="YKTth"><div align="center">开/关</div></td>
		<td  height="25" class="YKTth"><div align="center">数据验证</div></td>
	  </tr>


		<?php

		 for($i=0;$i<$fieldsCount;$i++)
			{
				$FieldName=$mydb->db_fetch_field($rsc);

				if($FieldName->primary_key!=1)
				{
					if($i>count($arrFormConfig))
					{
						$ArrField=explode("|"," | | | | |");
					}
					else
					{
						if($arrFormConfig[$i]!="")
						{
						   $ArrField=explode("|",$arrFormConfig[$i]);
					    }
					}


		?>

	  <tr onMouseOver = "this.style.backgroundColor = '#cccccc'" onMouseOut = "this.style.backgroundColor = ''" >
		<td height="25" class="YKTtd"><div align="center"><?php echo $i;?></Div></td>
		<td height="25" class="YKTtd"><label>
		  <div align="center">
			<input type="text" name="<?php echo "Name_$i";?>" value="<?php echo $ArrField[0];?>"  size="10"/>
		  </div>
		</label></td>
		<td height="25" class="YKTtd"><label>
		  <div align="center">
			<select name="<?php echo "Input_$i"; ?>" onchange="javascript:GetClassList(<?php echo "Div_$i";?>,this.value,'<?php echo "Class_$i"; ?>');" >
			  <option value="1" <?php  if($ArrField[1]=="1") echo "selected='selected'"; ?> >文本框</option>
			  <?php if($FieldName->type=="int")
			  {?>
			  <option value="3" <? if($ArrField[1]=="3") echo "selected='selected'"; ?>>单选框</option>
			   <option value="2" <? if($ArrField[1]=="2") echo "selected='selected'"; ?>>下拉框</option>
			  <option value="9" <? if($ArrField[1]=="9") echo "selected='selected'"; ?>>发布ID</option>
               <option value="18" <? if($ArrField[1]=="18") echo "selected='selected'"; ?>>列表属性</option>
                <option value="8" <? if($ArrField[1]=="8") echo "selected='selected'"; ?>>日期值</option>
                <option value="22" <? if($ArrField[1]=="22") echo "selected='selected'"; ?>>模块列表</option>
			  <? }?>
			  <? if($FieldName->type=="string" || $FieldName->type=="blob" )
			  {
			  ?>
			  <option value="4" <? if($ArrField[1]=="4") echo "selected='selected'"; ?>>复选框</option>
			  <option value="5" <? if($ArrField[1]=="5") echo "selected='selected'"; ?>>上传框</option>
			  <option value="6" <? if($ArrField[1]=="6") echo "selected='selected'"; ?>>编辑器</option>
			  <option value="10" <? if($ArrField[1]=="10") echo "selected='selected'"; ?>>审核ID</option>
			  <option value="17" <? if($ArrField[1]=="17") echo "selected='selected'"; ?>>文本域</option>
              <option value="19" <? if($ArrField[1]=="19") echo "selected='selected'"; ?>>模板文件</option>
              <option value="20" <? if($ArrField[1]=="20") echo "selected='selected'"; ?>>静态地址</option>
              <option value="21" <? if($ArrField[1]=="21") echo "selected='selected'"; ?>>单项多分</option>
              <option value="23" <? if($ArrField[1]=="23") echo "selected='selected'"; ?>>标识框</option>
              <option value="24" <? if($ArrField[1]=="24") echo "selected='selected'"; ?>>地图坐标框</option>
               <option value="25" <? if($ArrField[1]=="25") echo "selected='selected'"; ?>>价格日历框</option>
			  <? }?>

			  <?php if($FieldName->type=="string" || $FieldName->type=="blob" || $FieldName->type=="datetime" || $FieldName->type=="real")
			  {
			  ?>

			  <option value="8" <? if($ArrField[1]=="8") echo "selected='selected'"; ?>>日期值</option>
			  <?php }?>

			  <option value="7" <? if($ArrField[1]=="7") echo "selected='selected'"; ?>>隐藏值</option>
			  <option value="11" <? if($ArrField[1]=="11") echo "selected='selected'"; ?>>栏目ID</option>
			  <option value="14" <? if($ArrField[1]=="14") echo "selected='selected'"; ?>>主表ID</option>
			  <option value="15" <? if($ArrField[1]=="15") echo "selected='selected'"; ?>>从表ID</option>
			  <option value="16" <? if($ArrField[1]=="16") echo "selected='selected'"; ?>>密码框</option>
			</select>

		  </div>
		</label></td>
		<td height="25" class="YKTtd"><div align="center" id="<?php echo "Div_$i"; ?>" date=""><?php
		if($ArrField[1]=="2" || $ArrField[1]=="3" || $ArrField[1]=="4"){
			 echo CreateClassList($mydb,"Class_" .$i,$ArrField[2]);
		}
		if($ArrField[1].""=="18"){	
			echo CreateClassList($mydb,"Class_" .$i,$ArrField[2],$SystemTablename[5]);
		}
		if($ArrField[1]=="22"){
			echo CreateClassList($mydb,"Class_" .$i,$ArrField[2],$SystemTablename[4]);
		}


		 ?></div></td>
		<td height="25" class="YKTtd"><div align="center">
		  <input type="text" name="<?php echo "Mark_".$i; ?>"  id="<?php echo "Mark_".$i; ?>" value="<?php echo   htmlspecialchars($ArrField[3],ENT_QUOTES);?>"/>
		</div></td>
		<td height="25" class="YKTtd"><div align="center"><?php echo $FieldName->name;?></div></td>
		<td height="25" class="YKTtd"><div align="center"><?php echo GetFieldType($FieldName->type);?></div></td>
		<td height="25" class="YKTtd"><div align="center">
		  <select name="<?php echo "Show_" .$i; ?>">
			<option value="0" <?php if( $ArrField[4]=="0")
			{
			 echo "selected='selected'";
			 } ?>>开</option>
			<option value="1" <?php if( $ArrField[4]=="1")
			{
			 echo "selected='selected'";
			 } ?>>关</option>
		  </select>
		</div></td>
		<td height="25" class="YKTtd"><div align="center">
		  <input type="text" name="<?php echo "Check_" .$i; ?>"  value="<?php echo $ArrField[5];?>" size="20"/>
		</div></td>
	  </tr>


		<?php
		}
			//End IF

		}

	?>
</table>


<?php


	$StrListConfig=GetListConfig($mydb,$MenuId);
	if($StrListConfig==NULL)
	{
		$ArrListConfig=explode(",",",,,,,");
		$ArrPower=explode("|","||||");
	}
	else
	{
		$ArrListConfig=explode(",",$StrListConfig);
		$ArrPower=explode("|",$ArrListConfig[1]);
	}


?>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="YKTtable">
  <tr>
    <td width="18%" class="YKTtd"><div align="right">显示的字段列表:</div></td>
    <td colspan="2" class="YKTtd"><input name="FieldList" type="text" id="FieldList" size="50" value="<? echo $ArrListConfig[0];?>">
     形式 字段1/宽度/对齐方式|字段n/宽度/对齐方式</td>
  </tr>
  <tr>
    <td class="YKTtd"><div align="right">功能列表:</div></td>
    <td width="47%" class="YKTtd"><label>
      <input name="checkbox1" type="checkbox" value="1"  <? if($ArrPower[0]=="1") echo "checked='checked'" ?>>
      添加
      <input type="checkbox" name="checkbox2" value="1" <? if($ArrPower[1]=="1") echo "checked='checked'" ?>>
      修改
      <input type="checkbox" name="checkbox3" value="1" <? if($ArrPower[2]=="1") echo "checked='checked'" ?>>
删除
<input type="checkbox" name="checkbox4" value="1" <? if($ArrPower[3]=="1") echo "checked='checked'" ?>>
审核
<input type="checkbox" name="checkbox5" value="1" <? if($ArrPower[4]=="1") echo "checked='checked'" ?>>
翻页</label></td>
    <td width="35%" class="YKTtd"><label>
      <input name="PageSize" type="text" id="PageSize" size="6" value="<? echo $ArrListConfig[2];?>">
    </label>
      条／页 *每页显示的记录条数 </td>
  </tr>
  <tr>
    <td class="YKTtd"><div align="right">在各页面显示的标题</div></td>
    <td colspan="2" class="YKTtd"><input name="InfoTitle" type="text" id="InfoTitle" size="50"  value="<? echo $ArrListConfig[3];?>">

	  　　　　<label>
  <input name="MenuShow"  checked="checked"  type="radio" value="0">
  在栏目中显示  <input name="MenuShow"  <?  if(IsMenuShow($mydb,$MenuId)==false) echo "checked='checked'";?> type="radio" value="1">
  不在栏目中显示
  </label>	</td>
  </tr>
  <tr><td height="21" align="right" class="YKTtd">字段排序:</td><td class="YKTtd"><span class="YKTtd">
    <input name="FieldsPaixu" type="text" id="FieldsPaixu" size="50"  value="<? echo $ArrListConfig[4];?>" />
  </span></td><td class="YKTtd">最前面的排在第一位如“1/2/3/4/5”不需要的可以不写</td></tr>
  <tr><td height="21" align="right" class="YKTtd">列表排序:</td><td class="YKTtd"><span class="YKTtd">
    <input name="listPaixu" type="text" id="listPaixu" size="50"  value="<? echo $ArrListConfig[5];?>" />
  </span></td>
  <td class="YKTtd">就是后台记录列表时的order by的排序如:news1 desc/news2 desc</td></tr>
  <tr>
    <td height="21" align="right" class="YKTtd">修改或添加提交跳转地址:</td>
    <td class="YKTtd"><span class="YKTtd">
    <input name="editgotourl" type="text" id="editgotourl" size="50"  value="<? echo $ArrListConfig[6];?>" />
  </span></td>
  <td class="YKTtd">在记录修改或添加提交后跳转到的地址，其中&quot;@&quot;表示当前这条记录,&quot;{MenuId}&quot;表示Menuid,{PMID}表示PMID的值,值中不能有逗号</td></tr>
</table>
		  </p>
		<div align="center">
		  <label>
		  <input type="submit" name="Submit" value=" 保存 " />
          <input type="button" name="Submit2" value="取消" onClick="javascript:window.history.back();"/>
		  </label>
		</div>
		<p>&nbsp;</p>


<?
}

//======================================================================================

//是否在栏目中显示
	function IsMenuShow($mydb,$MenuId)
	{
		$IsMenuShow=true;
		global $SystemTablename;
		global $SystemConest;
		$sqlrs="Select ".$SystemTablename[2]."11 from ".$SystemConest[7].$SystemTablename[2]." where ".$SystemTablename[2]."0=" .$MenuId;
		$rsc=$mydb->db_select_query($sqlrs);
		$rs=$mydb->db_fetch_array($rsc);
		if($mydb->db_num_rows($rsc)>0)
		{
			 if($rs[0]=="1") $IsMenuShow=false;
		}
		return $IsMenuShow;
	}

function GetFieldType($typeanme)
{
	$FieldTypeName="";
	switch ($typeanme) {
    case "int":
       	$FieldTypeName="数字";
        break;
	 case "real":
       	$FieldTypeName="长数字";
        break;
    case "string":
        $FieldTypeName="文本";
        break;
   case "blob":
   		$FieldTypeName="备注";
        break;
	case "datetime":
		$FieldTypeName="日期";
        break;
	}
	return $FieldTypeName;
}


//保存表单配置
function FormConfigSave($mydb,$MenuId,$ConfigValue,$MenuShow)
{
		global $SystemTablename;
		global $SystemConest;
		if($MenuId=="") return "";
		$MenuFields[0]=$MenuId;
		$MenuFields[7]=$ConfigValue;

		$MenuFields[10]=CreateInfoList();
		$MenuFields[11]=$MenuShow;
		$FieldsCount=count($MenuFields);
		$mydb->ArrFields=array_values($MenuFields);
		$mydb->TableName=reTableName($mydb,$MenuId);
		$mydb->countTableName=$SystemTablename[2];
		$mydb->filesConent=$FieldCount-1;
		$sqlrs="update ".$SystemConest[7].$mydb->countTableName." set ".$SystemTablename[2]."7='".$MenuFields[7]."',".$SystemTablename[2]."10='".$MenuFields[10]."',".$SystemTablename[2]."11='".$MenuFields[11]."' where ".$SystemTablename[2]."0=".$MenuFields[0];

		$mydb->db_update_query($sqlrs);

}

//返回模块数据库表名
function reTableName($mydb,$MenuId)
{
	global $SystemTablename;
	global $SystemConest;
	$sqlrs="Select ".$SystemTablename[2]."0,".$SystemTablename[2]."9 From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."0=$MenuId  Order by ".$SystemTablename[2]."0";
	$rsc=$mydb->db_select_query($sqlrs);
	$rs=$mydb->db_fetch_array($rsc);
	if($mydb->db_num_rows($rsc)>0)
	{
		return $rs["".$SystemTablename[2]."9"];
	}
	else
	return "";
}

//获取菜单数
function GetMenuNum($MenuId,$mydb,$UserID)
{
	    global $SystemTablename;
		global $SystemConest;
		$GetMenuNum=-1;
	    if(strlen($MenuId)==0)
		{
			return $GetMenuNum;
		}
		$GetMenuNum=0;

		$sqlrs="Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=" . $MenuId;
		$rsc=$mydb->db_select_query($sqlrs);
		$GetMenuNum=$mydb->db_num_rows($rsc);

	return 	$GetMenuNum;
}


//显示左边菜单 MenuSys3=0 表示是一级栏目
function ShowMenu($mydb,$UserID)
{
	global $SystemTablename;
	global $SystemConest;
	$i=1;
	$sqlrs="Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=0  Order by ".$SystemTablename[2]."4";
	$rsc=$mydb->db_select_query($sqlrs);
	while($rs1=$mydb->db_fetch_array($rsc))
	{

		if(Menu2ReadRule($rs1[0],$mydb,$UserID))
		{
		   ?>
  <div align="left"><A href="#"  onClick="javascript:expandIt(<? echo $i;?>); return false"><table width="130" border="0" cellpadding="0" cellspacing="0" style=" cursor:hand; margin-top:3px; margin-left:-3px;">
  <tr>
    <td class="menu_1">&nbsp;<img src="Iamges/tubiao_yudian.gif" width="7" height="7" />&nbsp;&nbsp;<? echo $rs1[1];?></td>
  </tr>
</table>
</A></div>
           <?
				ShowMenu2($rs1[0],$mydb,$i,$UserID);
				$i=$i+1;
		}
	}
	//=========================================================================增加其它管理菜单开始
	 ?>

        <div  id="System_Child_<? echo $i;?>" class="child" style="margin-top:3px;"></div>
           <?

	//$i=$i+1;

	//============================================================================增加其它管理菜单结束



	return $i;
}

//获取用户权限值
function GetUserRule($strRules,$UserID)
{

	$GetUserRule=0;
    if($strRules=="")
		return false;

	if(strlen($strRules)>1)
	{
		$ArrRules=explode(",",$strRules);
		foreach($ArrRules as $Rule)
		{
			$ArrRuleItem=explode("|",$Rule);
			if($ArrRuleItem[0]==$UserID)
				$GetUserRule=$ArrRuleItem[1];
		}
	}

	return $GetUserRule;
}

//显示2级菜单
function ShowMenu2($MenuId,$mydb,$i,$UserID)
{
	global $SystemConest;
	global $SystemTablename;
	if($MenuId=="")
		return;
	$sqlrs="Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=$MenuId  Order by ".$SystemTablename[2]."4";
	$rsc=$mydb->db_select_query($sqlrs);?>
	 <div id="System_Child_<? echo $i;?>" class="child"><table width="120" border="0" cellpadding="2" cellspacing="0" style="margin-top:3px;">
	<?php
	while($Menu2Rs=$mydb->db_fetch_array($rsc))
	{
		if(GetReadRule(GetUserRule($Menu2Rs[8],$UserID)) ||  $_SESSION["Login"][1]==$SystemConest[2])
		 {
			  if(strlen(trim($Menu2Rs[2]))==0)
			 	{
			 ?>
  <tr>
    <td>
	<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
      <tr>
        <td height="12" align="center" class="Menu12W">&nbsp;<img src="Iamges/tubiao_yudian.png" width="7" height="7" />&nbsp;<?php $Menu2Rs[1];?></td>
      </tr>
    </table>
      </td>
  </tr>
			  <?php
			 }
		 else
		 {
		 ?>
  <tr>
    <td>
	<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
      <tr>
        <td height="12" align="center">&nbsp;<img src="Iamges/tubiao_yudian.png" width="7" height="7" />&nbsp;
        <?php
		global $SystemConest;
        $temp=$Menu2Rs[2]."?MenuId=".$Menu2Rs[0];
		if(strlen($Menu2Rs[12])>4) $temp=str_replace("{houtaipath}",$SystemConest[1],$Menu2Rs[12]);
		?>
        <a href="<?php echo $temp; ?>" target="mainFrame" class="Menu12W"><?php echo $Menu2Rs[1];?></a></td>
      </tr>
    </table>
      </td>
  </tr>
       <?php
		   }
		 }
	 }?>

   </table>
</div>
<?php
 }



//显示当前位置
function CurrPosition($MenuId,$mydb)
{
	global $SystemTablename;
	global $SystemConest;
	if(strlen($MenuId)<1) return "";
	$MenuFields[0]=(int)($MenuId);
	$mydb->ArrFields=$MenuFields;
	$rsc=$mydb->db_select_query("select * from ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."0=".$MenuId);
	$num=$mydb->db_num_rows($rsc);
	if($num==0) return "";
	$rs=$mydb->db_fetch_array($rsc);
	if($rs[3]<>0)
	{
		return "当前位置：".CurrPrePosition((int)($rs[3]),$mydb).">".$rs[1];
	}
	else
	{
		return $rs[1];
	}

}

//获取上级位置
function CurrPrePosition($MenuId,$mydb)
{
	global $SystemTablename;
	global $SystemConest;
	if(strlen($MenuId)==0) return "";
	$MenuFields[0]=$MenuId;
	$mydb->ArrFields=$MenuFields;
	$rsc=$mydb->db_select_query("Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."0=".$MenuId);
	$num=$mydb->db_num_rows($rsc);
	if($num==0) return "";
	$rs=$mydb->db_fetch_array($rsc);
	return $rs[1];
}


//=============================================
//  创建表单字段
//---------------------------------------------
//'  StrField   字段配置参数
//'  Conn       数据库连接
//'  FieldName  字段名称
//'  i          相同字段第几个
//'  FieldValue  字段值
//'=============================================
function CreateField($StrField,$mydb,$FieldName,$i,$FieldValue,$width1,$width2,$Style,$Style1,$rsid="")
{

	$HiddenValue="";
	$FieldTypeArr=explode("|",$StrField);
	$FieldType=$FieldTypeArr[1];

	switch ($FieldType)
	{
		case "1":
			TextBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1,$rsid);
			
			break;
		case "2":
			ListBox($StrField,$mydb,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);

			break;
		case "3":
			RadioBox($StrField,$mydb,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			
			break;
		case "4":
			Checkbox($StrField,$mydb,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "5":
			PictureBox($StrField,$FieldName,$i,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "6":
			EditBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "7":
			HiddenBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "8":
			DateBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "9":
			FaBuIDBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "10":
			ShenHeIDBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "11":
			MenuIdBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "14":
			ZhubiaoBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "16":
			PasswordBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "17":
			TextAreaBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "18":
			ListProperty($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "19":
			Moban($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "20":
			JingTaihtml($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "21":
			danxiangduofen($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "22":
			Pricelist($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "23":
			biaozhikuang($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "24":
			dituzhubiaozhi($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
		case "25":
			jiagerili($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1);
			break;
	}


}



//价格日历框-25
function jiagerili($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1,$thisrsid="")
{
	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{

	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<? echo $Style;?>">
        
         <input type="button" value="点击显示日历编辑" id="show_<?php echo $FieldName;?>_rili">
		 <div style="display:none" id="<?php echo $FieldName;?>_rili" name="<?php echo $FieldName;?>_rili">
         <iframe width="800" height="380" src="/inc/calendarprice.php?MenuId=<?php echo $_REQUEST["MenuId"];?>&tid=<?php echo $_REQUEST["ID"];?>&fieldid=<?php echo getsubstr($FieldName,"/[\d]+$/");?>" frameborder="0" scrolling="no" ></iframe>
         <br><span id="<?php echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span>
         </div>
         
        </td>
	  </tr>
      <script language="javascript">
	  	$(document).ready(function(){
			$("#show_<?php echo $FieldName;?>_rili").bind("click",function(){
				if($("#<?php echo $FieldName;?>_rili").is(":visible")){
						$("#<?php echo $FieldName;?>_rili").hide("slow");
						$(this).attr("value","点击显示日历编辑");
				}else{
						$("#<?php echo $FieldName;?>_rili").show("slow");
						$(this).attr("value","点击关闭日历编辑");
				}
			});
			
		});
	  
	  </script>
      
      
      
      
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}

}



//地图坐标值-24
function dituzhubiaozhi($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1,$thisrsid="")
{


	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{

	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<? echo $Style;?>">
         <input type="text" onclick="showcooseditu('<?php echo $FieldName;?>')" class="<?php echo $Style1;?>" value="<?php echo $FieldValue;?>" name="<?php echo $FieldName?>" id="<?php echo $FieldName?>">

        <span id="<?php echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span>
        调用google地图
        <div>
        
        <div id="map_canvas_<?php echo $FieldName;?>" style="width : 400px;height : 300px; display:none;"></div>
<script type="text/javascript">





function showcooseditu(){
	$("#map_canvas_<?php echo $FieldName;?>").show();
	$("#sekword_<?php echo $FieldName;?>").show();
	initialize("<?php echo $FieldName;?>","<?php echo $FieldValue;?>");
}


</script>
<div style="display:none" id="sekword_<?php echo $FieldName;?>">输入地名搜索:<input type="text" value="" name="kwordditu_<?php echo $FieldName;?>" id="kwordditu_<?php echo $FieldName;?>">
<input type="button" value="搜 索" name="sditu_<?php echo $FieldName;?>" id="sditu_<?php echo $FieldName;?>" onclick="searchAddress('<?php echo $FieldName;?>')">
</div>        

        </div>
        </td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}


//标识框-23
function biaozhikuang($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1,$thisrsid="")
{


	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{

	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<? echo $Style;?>">
         <?php

		 TturntoFunandField($ArrField[5],$FieldName,$value,$FieldValue,$Style1,$FieldType,$thisrsid);//生成表单属性项

		 ?>
        <span id="<?php echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span></td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}


//单项多分---21  像线路的出行天数，第一天的标题是什么内容是什么，第二天的标题是什么内容是什么，第三天的标题是什么内容是什么.....  但内容都在一个字段里
function danxiangduofen($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	global $SystemConest;
	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{
	?>
   <tr id="tr_<?php echo $FieldName;?>">
    <td class="<? echo $Style;?>" valign="top"><br><div align="right"><? echo $ArrField[0];?>：</div>
     <div align="right">
     <span id="<? echo $FieldName;?>_Msg" name="<? echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span>
     </div>
    </td>
    <td class="<? echo $Style;?>">

		<?
		//分析天数

		//转换默认值,仅当字段值为空时生效
		if($FieldValue=="")
		{
				$FieldValue=getturntoFunandField($ArrField[5],$FieldName,$value,$FieldValue);
				$temp2moren=stripslashes($FieldValue);//规定其它项的默认值
		}

		$tarr=explode(DanxuangduofenC,$FieldValue);

		for($i=0;$i<count($tarr);$i++)
		{
			//折分每一项的标题和内容$tarr[$i]其它属性选项
			$juti=explode(DanxuangduofenT,$tarr[$i])
			
			?>
        	<div id='geshi<? echo $FieldName."_".($i+1);?>'> 
		    <span id="dantitle_<?php echo $FieldName."_".($i+1);?>">第<?php echo $i+1;?>天,</span> <span id="deldanx_<?php echo $FieldName."_".($i+1);?>">取消第<?php echo $i+1;?>天</span><br>
             标题:<input name="<?php echo $FieldName."title_".$i;?>" id="<?php echo $FieldName."title_".$i;?>" type="text" value="<? echo stripslashes($juti[0]);?>" / > 关链图片<input name="<?php echo $FieldName."pic_".$i;?>" id="<?php echo $FieldName."pic_".$i;?>" type="text" value="<? echo stripslashes($juti[2]?$juti[2]:"");?>" />多个关键字用逗号分隔<br>

			<textarea cols="80" id="<?php echo $FieldName."_".$i;?>" name="<?php echo $FieldName."_".$i;?>" rows="10"><?php echo stripslashes($juti[1]?$juti[1]:"");?></textarea>
			<script type="text/javascript">
				CKEDITOR.replace( '<?php echo $FieldName."_".$i;?>', {
					extraPlugins : 'autogrow',
					autoGrow_maxHeight : 400
				});
			</script>
            </div>
		<?php }
		?>



        <span id="<?php $FieldName?>rongqi"></span>
        <input type="hidden" value="" name="<?php echo $FieldName;?>" id="<?php echo $FieldName;?>">
         <br> <span id="adddanxiang"> 添加下一天</span>
        <script language="javascript">
			$("#adddanxiang").bind("click",function(){
				aaa=$("#<?php $FieldName?>rongqi").html();
				tnum=$("textarea[id^='<?php echo $FieldName."_";?>']").length;
				thisnum=tnum+1;
				temp2moren="<?php echo $temp2moren;?>"
				bbb="<div id='geshi<? echo $FieldName;?>_"+thisnum+"'><span id='dantitle_<?php echo $FieldName;?>_"+thisnum +"'>第"+thisnum +"项</span>  <span id='deldanx_<? echo $FieldName;?>_"+thisnum +"'>取消第"+thisnum +"项</span><br>"
				bbb=bbb+"标题:<input name='<?php echo $FieldName."title_";?>"+tnum+"' id='<?php echo $FieldName."title_";?>"+tnum+"' type='text' value='' /> 关链图片<input name='<?php echo $FieldName."pic_";?>"+tnum+"' id='<?php echo $FieldName."pic_";?>"+tnum+"' type='text' value='' />多个图片之间用逗号分隔"
				bbb=bbb+"<br>	<textarea name='<?php echo $FieldName."_";?>"+tnum+"' id='<?php echo $FieldName."_";?>"+tnum+"' cols='60' rows='8'>"+temp2moren+"</textarea></div>";
				
				$("#<?php $FieldName?>rongqi").html(aaa+bbb);
				CKEDITOR.replace( "<?php echo $FieldName."_";?>"+tnum, {
						extraPlugins : 'autogrow',
						autoGrow_maxHeight : 400
				});
			});
			$("span[id^='deldanx_<? echo $FieldName;?>_']").live("click",function(index){

				thisid=$(this).attr("id");
				thisid=thisid.replace("deldanx_","");
				$("#geshi"+thisid).hide('fast');
				$("#geshi"+thisid).remove();
				alert("取消成功,这一天数据清除,后面的依次递减一天");
				//对现有的节点重新命名一次，因为中间的节点不存在了，命名会冲突
				$("textarea[id^='<?php echo $FieldName."_";?>']").each(function(index){
					$(this).attr("id","<? echo $FieldName;?>_"+index);
					$(this).attr("name","<? echo $FieldName;?>_"+index);
				});

				$("span[id^='geshi<? echo $FieldName;?>_']").each(function(index){
					$(this).attr("id","geshi<? echo $FieldName;?>_"+(index+1));
				});

				$("span[id^='dantitle_<? echo $FieldName;?>_']").each(function(index){
					$(this).attr("id","dantitle_<? echo $FieldName;?>_"+(index+1));
					$(this).html("第"+(index+1)+"项");
				});

				$("span[id^='deldanx_<? echo $FieldName;?>_']").each(function(index){
					$(this).attr("id","deldanx_<? echo $FieldName;?>_"+(index+1));
					$(this).html("取消第"+(index+1)+"项");
				});

			});

		</script>



      </td>
  </tr>

	 <?
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}

//静态地址---20  为了生成产品列表的静态页的静态地址，
function JingTaihtml($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
		$ArrField=explode("|",$StrField);
		if($ArrField[4]==0)
	{

	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<? echo $Style;?>">
         <?php
		 TturntoFunandField($ArrField[5],$FieldName,$value,$FieldValue,$Style1,"20");//生成表单属性项
		 ?><span id="<?php echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span>
        </td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}

// 模板框 --19 为了生成产品列表的静态页的模板框，其值在配置表单的时候赋值，其余时间不得修改
function Moban($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
		$ArrField=explode("|",$StrField);
		if($ArrField[4]==0)
	{

	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<? echo $Style;?>">
         <?php
		 TturntoFunandField($ArrField[5],$FieldName,$value,$FieldValue,$Style1,"19");//生成表单属性项
		 ?>
        </td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}


//文本框-1
function TextBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1,$thisrsid="")
{


	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{

	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<? echo $Style;?>">
         <?php
		 TturntoFunandField($ArrField[5],$FieldName,$value,$FieldValue,$Style1,$FieldType,$thisrsid);//生成表单属性项
		 ?>
        <span id="<?php echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span></td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}


//价格列表-22 比如多价格列表模式，这个列表中又有其它模式时
function Pricelist($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	//此模式只在修改的时候显示
	if($_GET["OwerID"] !="")
	{
	$ArrField=explode("|",$StrField);
	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<?php echo $Style;?>" align="right"><?php echo $ArrField[0];?>：</td>
		<td width="<?php echo $width2;?>" class="<?php echo $Style;?>">
      
       <iframe id="ifr_<? echo $FieldName;?>" style="top:2px"  src="../price/Index.php?MenuId=<?php echo $ArrField[2];?>&PMID=<? echo $_REQUEST["ID"];?>&StrField=<?php echo  $StrField;?>&FieldName=<?php echo  $FieldName;?>&FieldValue=<?php $FieldValue?>&width1=<?php echo $width1;?>&width2=<?php echo $width2;?>&Style=<?php echo $Style;?>&Style1=<?php echo $Style1;?>" frameborder=0  scrolling="auto" width="100%" height="250"></iframe>
      </td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}


//列表属性-18 比如它的这个性性要用一个列表来表示时
function ListProperty($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	//此模式只在修改的时候显示
	if($_GET["OwerID"] !="")
	{
	$ArrField=explode("|",$StrField);
	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<?php echo $Style;?>" align="right"><?php echo $ArrField[0];echo $ArrField[5];?>：</td>
		<td width="<?php echo $width2;?>" class="<?php echo $Style;?>"><iframe  style="top:2px" ID="mycityhot" src="Action_ListProperty.php?cid=<? echo $_REQUEST["ID"];?>&StrField=<?php echo  $StrField;?>&FieldName=<?php echo  $FieldName;?>&FieldValue=<?php $FieldValue?>&width1=<?php echo $width1;?>&width2=<?php echo $width2;?>&Style=<?php echo $Style;?>&Style1=<?php echo $Style1;?>" frameborder=0  width="100%" height="150"></iframe>
		</td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}


//密码框-16
function PasswordBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	$ArrField=explode("|",$StrField);

	if($ArrField[4]==0)
	{
	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<?php echo $Style;?>"><div align="right"><?php echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<?php echo $Style;?>"> <input name="<?php echo $FieldName;?>" id="<?php echo $FieldName;?>" type="password" value="<?php echo $FieldValue;?>" class="<?php echo $Style1;?>"><span id="<?php echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span></td>
	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}



//下拉框-2
function ListBox($StrField,$mydb,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	global $SystemTablename;
	global $mydb;
	global $SystemConest;
	$ArrField=explode("|",$StrField);
	$ClassID=$ArrField[2];

	if($ClassID=="") return "";

	$strSelect="";

	if($ArrField[4]==0)
	{
		$OptionItem="";
		$MenuIdnum=$mydb->getMenuIdNum($ClassID);
		$sqlrs="Select * From ".$SystemConest[7].$SystemTablename[0]." Where ".$SystemTablename[0]."2=0 And ".$SystemTablename[0].$MenuIdnum."=".$ClassID;
		$rsc=$mydb->db_select_query($sqlrs);
		
		$temp=GetMaxClassID($mydb,$FieldValue);
		
		while($rs=$mydb->db_fetch_array($rsc))
		{
			$OptionItem=$OptionItem. "<option " .$strSelect  . " value='".$rs[0]  ."' MinClass='". $temp1 ."' onSelect='alert(this.MinClass);'>" . $rs[1]. "</option>";
		}
		
		?>
		<tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<?php echo $Style;?>"><div align="right"><?php echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<?php echo $Style;?>">
			<script language="javascript">
				

				$(document).ready(function(){
					$("#<?php echo $FieldName;?>").bind("change",function(){

						aa=$("#<?php echo $FieldName;?>").val();
						$("#<?php echo $FieldName;?>_class").val(aa);

					$.ajax({
						url: "showClass_select.php?fid="+aa+"&MenuId=<?php echo $ClassID?>&FieldName=<?php echo $FieldName?>",//目标页地址，暂不支持跨域获取
						beforeSend: function(){},
						cache: false,//是否开启客户端缓存
						success: function(html){
							//过虑翻页代码
							//$("#<?php echo $FieldName;?>_Span_c").html(html);
							document.getElementById("<?php echo $FieldName;?>_Span_c").innerHTML=html;
							getxclass("<?php echo $FieldName;?>",aa,"<?php echo $ClassID?>");
							html="";
						}
						});
					});



				});



			</script>


            <input type="hidden" value="<? echo $FieldValue;?>" name="<? echo $FieldName."_class"?>"  id="<? echo $FieldName."_class"?>"/>
			<select name="<?php echo $FieldName;?>" id="<?php echo $FieldName;?>" class="<?php echo $Style1;?>"   >
			<option value="" >请选择...</option>
			<?php echo $OptionItem;?>
			</select>
			<span id="<?php echo $FieldName;?>_Span_c"></span>
			<span id="syscontesp<?php echo $FieldName;?>"></span>
			<span id="<?php echo $FieldName;?>_Msg">　<?php echo $ArrField[3];?></span></td>




	  </tr>
	<?php
	//加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}




//单选框-3
function RadioBox($StrField,$mydb,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	global $SystemTablename;
	global $SystemConest;
	$ArrField=explode("|",$StrField);
	$ClassID=$ArrField[2];
	
	if($ArrField[4]==0)
	{

		$OptionItem="";
		$sqls="Select * From ".$SystemConest[7].$SystemTablename[0]." Where ".$SystemTablename[0]."2=0 And ".$SystemTablename[0].$mydb->getMenuIdNum($ClassID)."=".$ClassID;
		$rsc=$mydb->db_select_query($sqls);
		$FormConfigValue=GetFormConfig($mydb,$ArrField[2]);
		$ganlx=GetInputTypeIndex($FormConfigValue,"23");//获取标识符所在的字段号
		$ganlianstr="";
		
		while($ClassRs=$mydb->db_fetch_array($rsc))
		{
			if($ClassRs[0].""== $FieldValue)
			{
				
		   		$OptionItem=$OptionItem . "<input  name='" . $FieldName . "' id='" . $FieldName . "' type='radio' checked='checked' value='". $ClassRs[0]  ."' biaozhistr='".$ClassRs[$SystemTablename[0]."".$ganlx]."'>" . $ClassRs[1] . "</input>";
		    }
		   else
		   {

		   		$OptionItem=$OptionItem . "<input  name='". $FieldName . "' id='". $FieldName . "' type='radio' value='". $ClassRs[0]  ."' biaozhistr='".$ClassRs[$SystemTablename[0]."".$ganlx]."'>". $ClassRs[1] . "</input>";
		   }
				
		 if($ganlx.""!="") $ganlianstr=$ganlianstr.$ClassRs[$SystemTablename[0]."".$ganlx].",";
		}
	 	
	

	?>

	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<?php echo $Style;?>"><div align="right"><?php echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<?php echo $Style;?>">
	
    
    	
	
	<?php echo $OptionItem;?> <span id="<?php echo $FieldName;?>_Msg"><?php echo $ArrField[3];?></span>

		<?php 
	//加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);

		 //并把动作执行的结果返回到表单里的第num字段去
		if($ganlianstr!="" && $_REQUEST["PMID"]!="")
		{
			$ganlianstr=substr($ganlianstr,0,-1);
			//获取周出发所以要放的字段序号地方
			$xuhaozhifile_week=getkuohaostr($ganlianstr,"/week\|([\d]+)/");
			$xuhaozhifile_anydate=getkuohaostr($ganlianstr,"/anydate\|([\d]+)/");
			
			?>
			
             <div id="<?php echo $FieldName;?>xuan_week" style="display:none">
    选择发团周星期:
    <input name="<?php echo $FieldName;?>week[]" type="checkbox" value="周一" />周一 
    <input name="<?php echo $FieldName;?>week[]" type="checkbox" value="周二" />周二
    <input name="<?php echo $FieldName;?>week[]" type="checkbox" value="周三" />周三
    <input name="<?php echo $FieldName;?>week[]" type="checkbox" value="周四" />周四
    <input name="<?php echo $FieldName;?>week[]" type="checkbox" value="周五" />周五
    <input name="<?php echo $FieldName;?>week[]" type="checkbox" value="周六" />周六
    <input name="<?php echo $FieldName;?>week[]" type="checkbox" value="周日" />周日
  <hr size="1" width="100%">  </div>
            
 <div id="<?php echo $FieldName;?>xuan_anydate" style="display:none; margin-top:5px; margin-bottom:5px;"><a id="<?php echo $FieldName;?>_choolesdate">更选时间[点击选择]</a></div>
      	<input type="hidden" id="<?php echo $FieldName;?>_choolesdate_temp" value="">
        <input type="hidden" id="<?php echo $FieldName;?>_chooleweek_temp" value="">
        
            <script src="/jsLibrary/cdate_py_z.js"></script>
            
			<script language="javascript">
				//初始化勾选状态
				
				$(document).ready(function(){
					var initdatexiu="<?php echo $FieldName;?>".replace(/[\d]+$/,"");
					//初始化周发团模式的值
					var initdatexiucontent=$("#"+initdatexiu+"<?php echo $xuhaozhifile_week?>").val()+"";
					
					if(initdatexiucontent.search("周")>-1) $("#<?php echo $FieldName;?>_chooleweek_temp").val(initdatexiucontent);
					//初始化任意发团模式的值
					var initanyd=$("#"+initdatexiu+"<?php echo $xuhaozhifile_anydate?>").val()+"";
					if(initanyd.search("201")>-1)  $("#<?php echo $FieldName;?>_choolesdate_temp").val(initanyd);
					
					$("input[name^='<?php echo $FieldName;?>week']").each(function(){
						if(initdatexiucontent.search($(this).val())>-1) {
							$(this).attr("checked",true)};
					});
					
					
						
				});
				
			
				$("input[id^='<?php echo $FieldName ; ?>']").bind("click", function(){
					

					//先隐藏附属内容
					$("div[id^='<?php echo $FieldName;?>xuan_']").hide();
					var biaozhistr=$(this).attr("biaozhistr");
					var faction=biaozhistr.replace(/\|[\d]+$/,"");
					tonum=biaozhistr.replace(/^[\w]+\|/,"");
					typed="<?php echo $FieldName;?>";
					addtoname=typed.replace(/[\d]+$/,"")+tonum;
					
					if(faction=="week")
					{
						//调用星期复选框
						ctemp=$("#<?php echo $FieldName;?>_chooleweek_temp").val()
						$("#"+addtoname).val(ctemp);

						$("#<?php echo $FieldName;?>xuan_week").fadeIn(500);
						
						$("input[name^='<?php echo $FieldName;?>week']").bind("click", function(){
							
							//调用一个函数，把日期里的值存入  addtoname
							var temp="";
							$("#"+addtoname).val(temp);
							
							$("input[name^='<?php echo $FieldName;?>week']").each(function(){
								if($(this).attr("checked")) temp+=$(this).val() +",";
							});
							if(temp!="") temp=temp.replace(/,$/,"");
							$("#<?php echo $FieldName;?>_chooleweek_temp").val(temp)
							$("#"+addtoname).val(temp);
						});
											
						
					}
					if(faction=="anydate")
					{
						//调用日历复选框,实现能够，多选时间
						
						ctemp=$("#<?php echo $FieldName;?>_choolesdate_temp").val()
					    $("#"+addtoname).val(ctemp);
						$("#<?php echo $FieldName;?>xuan_anydate").fadeIn(500);
						
						
						$("#<?php echo $FieldName;?>_choolesdate").bind("click",function(){
							temp=$("#<?php echo $FieldName;?>_choolesdate_temp").val();
							url="guanli=mzl&rydate=anydate&indate="+temp;
							cdate_show("<?php echo $FieldName;?>_choolesdate_temp",url)
							$(document).bind("focusin",function(){
								cvl=$("#<?php echo $FieldName;?>_choolesdate_temp").val();
								$("#"+addtoname).val(cvl);
							});
							
							
						});
						
					}
					if(faction+""=="")
					{
							$("#"+addtoname).val("");
					}
					
					
				});
			
			</script>
			
			
			
			<?php 
			
		}
		?>	

		</td>

	  </tr>
	 <?php
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}


//复选框-4
function Checkbox($StrField,$mydb,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	global $SystemTablename;
	global $SystemConest;
	$ArrField=explode("|",$StrField);
	$ClassID=$ArrField[2];

	if(is_null($FieldValue));

	if($ArrField[4]=="0")
	{
		$OptionItem="";
		$rsc=$mydb->db_select_query("Select * From ".$SystemConest[7].$SystemTablename[0]." Where ".$SystemTablename[0]."2=0 And ".$SystemTablename[0].$mydb->getMenuIdNum($ClassID)."=" .$ClassID);

		while($ClassRs=$mydb->db_fetch_array($rsc))
		{
			if(strstr($FieldValue."",",".$ClassRs[0].","))
			{

			   $OptionItem=$OptionItem . "<input name='" . $FieldName. "[]' id='" . $FieldName . "' type='checkbox' checked='checked' value='". $ClassRs[0]  ."'>" . $ClassRs[1] . "</input>";
		   	}
		   else
		   {
			   $OptionItem=$OptionItem. "<input name='" . $FieldName . "[]' id='" . $FieldName . "' type='checkbox' value='".$ClassRs[0] ."'>" . $ClassRs[1] . "</input>";
		   }

		   $i++;
		}


	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<?php echo $Style;?>"><div align="right"><?php echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<?php echo $Style;?>">	<?php echo $OptionItem;?>　<span id="<?php echo $FieldName;?>_Msg"><?php echo $ArrField[3];?></span></td>

	  </tr>
	 <?
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}

function IsChecked($FieldValue,$CheckValue)
{
   $ArrCheck=explode(",",$FieldValue);
   foreach($ArrCheck as $v)
   {
   		if(str_replace(" ","",$v."")==$CheckValue) return true;
   }
   return false;

}

//图片框-5
function PictureBox($StrField,$FieldName,$i,$FieldValue,$width1,$width2,$Style,$Style1)
{

	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{

	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<?php echo $width1;?>" class="<?php echo $Style;?>"><div align="right"><?php echo $ArrField[0];?>：</div></td>
		<td width="<?php echo $width2;?>" class="<?php echo $Style;?>">

			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td width="20%" align="left" valign="middle"><input type="text"  name="<?php echo $FieldName;?>" id="<?php echo $FieldName;?>"   usemap="<?php echo $FieldValue;?>" class="<?php echo $Style1;?>" value="<? echo $FieldValue;?>">
				  <iframe id="<?php echo $FieldName;?>_File" name="<?php echo $FieldName;?>_File" height="23" width="320" src="/inc/Up_file.php?getelementId=<?php echo $FieldName;?>&formId=MyForm" frameborder="0" scrolling="no"></iframe>
			</td>
				<td width="80%" align="left" valign="middle" class="<?php echo $Style;?>"><span id="<?php echo $FieldName;?>_Msg" ><?php echo $ArrField[3];?></span></td>
			  </tr>
			</table>

		</td>
	  </tr>
	 <?
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}

//编辑框-6
function EditBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	global $SystemConest;
	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{
		

	?>
   <tr id="tr_<?php echo $FieldName;?>">
    <td class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
    <td class="<? echo $Style;?>">
        <div style="width:600px;height:300px;">
		
        <textarea cols="80" id="<?php echo $FieldName;?>" name="<?php echo $FieldName;?>" rows="10"><?php echo stripslashes($FieldValue);?></textarea>
			<script type="text/javascript">
				CKEDITOR.replace( '<?php echo $FieldName;?>', {
					extraPlugins : 'autogrow',
					autoGrow_maxHeight : 400
				});
			</script>
        </div>
      </td>
  </tr>

	 <?
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}

//隐藏值-7
function HiddenBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{


	$ArrField=explode("|",$StrField);

	if($ArrField[4]==0)
	{
	TturntoFunandField($ArrField[5],$FieldName,$value,$FieldValue,$Style1,"7");//生成表单属性项
	}


}
//隐藏值主表值-7
function ZhubiaoBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	?><input name="<? echo $FieldName;?>" id="<? echo $FieldName;?>" type="hidden" value="<? echo ($FieldValue!="")?$FieldValue:$_REQUEST["PMID"];?>" class="<?php echo $Style1;?>">
    <?
}



//日期值-8
function DateBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{

	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{
	
	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<? echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<? echo $width2;?>" class="<? echo $Style;?>">
        <?php 
        $FieldValue=($FieldValue!="")?date("Y-m-d H:i:s",$FieldValue):date("Y-m-d H:i:s");
       TturntoFunandField($ArrField[5],$FieldName,$value,$FieldValue,$Style1,"8");//生成表单属性项 ?>
        
        
        
        <!--<input type="text" name="<? echo $FieldName;?>" id="<? echo $FieldName;?>" value="<? echo ($FieldValue!="")?date("Y-m-d H:i:s",$FieldValue):date("Y-m-d H:i:s");?>" class="<? echo $Style1;?>" onClick="showCal(<? echo $FieldName;?>);">
		--><span id="<? echo $FieldName;?>_Msg">　<? echo $ArrField[3];?></span>
		<script language="javascript">
		
		$("#<?php echo $FieldName;?>").bind("click",function(){
		showCal(this);
		});
			
		</script>
		
		
		</td>
	  </tr>
	 <?
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}

//发布ID-9
function FaBuIDBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{
	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{
	?>
	<input name="<? echo $FieldName;?>" type="hidden" value="<? echo $FieldValue;?>" class="<?php echo $Style1;?>">
	 <?
	}
}

//审核ID-10
function ShenHeIDBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{

	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{
	?>
	<input name="<? echo $FieldName;?>" type="hidden" value="<? echo $FieldValue;?>" class="<? echo $Style1;?>">
	 <?
	}
}

//栏目ID-11
function MenuIdBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{

	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{
	?>
	<input name="<? echo $FieldName;?>" type="hidden" value="<? echo $FieldValue;?>" class="<? echo $Style1;?>">
	 <?
	}
}




//textarea
function TextAreaBox($StrField,$FieldName,$FieldValue,$width1,$width2,$Style,$Style1)
{

	$ArrField=explode("|",$StrField);
	if($ArrField[4]==0)
	{
	?>
	  <tr id="tr_<?php echo $FieldName;?>">
		<td width="<? echo $width1;?>" class="<? echo $Style;?>"><div align="right"><? echo $ArrField[0];?>：</div></td>
		<td width="<? echo $width2;?>" class="<? echo $Style;?>"><textarea name="<? echo $FieldName;?>"  id="<? echo $FieldName;?>" rows="10" cols="50" ><? echo htmlspecialchars($FieldValue);?></textarea><span id="<? echo $FieldName;?>_Msg">　<? echo $ArrField[3];?></span></td>
	  </tr>
	 <?
	 //加载能操作栏目的函数
	if($ArrField[5]!="") loadlanmuAction($ArrField[5],$FieldName);
	}
}



function MessgBox($PicPath,$Msg,$URL)

{ global $SystemConest;?>
  <table width="95%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="555" height="180"><div align="right"><img src="<? echo $PicPath;?>" width="227" height="119" /></div></td>
    <td width="13"></td>
    <td width="358" valign="bottom" ><p class="TDLine"><? echo $Msg;?> </p>
    <p>&nbsp;</p></td>
  </tr>
  <tr>
    <td colspan="3"><div align="center">　　　　　　　 <a href="<? echo $URL;?>"><img src="/<? echo $SystemConest[1];?>/Iamges/Back.jpg" width="171" height="52" border="0" /></a></div></td>
  </tr>
</table>
<? }

//生成关联数据列表
function CreateClassList($mydb,$SelectName,$SelectItem,$modname="")
{
		return "<select name='".$SelectName . "'>". GetClassList($mydb,$SelectItem,$modname) . "</select>";
}

//获取关联分类ID
function  GetClassList($mydb,$SelectItem,$modname="")
{

		global $SystemTablename;
		global $SystemConest;
		$newmodename=($modname=="")?$SystemTablename[0]:$modname;
		//当有多个$newmodename值时,分解,一般格式是以逗号分隔
		$temparr=explode(",", $newmodename);
		$subsql="";
		foreach ($temparr as $v){
			$subsql.=" ".$SystemTablename[2]."2='System/".$v."/Index.php' or";
		}
		$subsql=substr($subsql, 0,-2);
	    //Dim MenuRs,StrTemp1,StrTemp2,StrTemp3
		$StrTemp2="";
		//StrTemp3="</select>"
		
		$rsc=$mydb->db_query("Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$subsql."  Order by ".$SystemTablename[2]."4 ASC");
		
		while($MenuRs=$mydb->db_fetch_array($rsc))
		{

				if($SelectItem.""==$MenuRs[0].""){
					$StrTemp2=$StrTemp2 . "<option value='" .  $MenuRs[0] . "' selected='selected'>".$MenuRs[1] . "</option>";
				}
				else{
					$StrTemp2=$StrTemp2 . "<option value='".  $MenuRs[0] . "' >" . $MenuRs[1] . "</option>";
				}
		}

		if($StrTemp2=="")
		{
			return "请添加分类";
		}
		else
		{
			return $StrTemp2;
		}

}

//获取表的字段数
function GetTableFieldCount($mydb,$TableName)
{
	global $SystemConest;
	$sqlrs=$mydb->db_query("select * from ".$SystemConest[7]."$TableName order by ".$TableName."0 limit 1" );
	return $mydb->db_num_fields($sqlrs);
}


//保存所有权限 CmdType的值为 Add-添加权限保存 Delete-删除权限保存
	function AllRuleSave($mydb,$UserID,$CmdType)
	{
	   global $SystemTablename;
		global $SystemConest;
		$sqlrs="Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=0  Order by ".$SystemTablename[2]."4 ASC";

		$rsc=$mydb->db_query($sqlrs);
		$rs=$mydb->db_fetch_array($rsc);
		$num=$mydb->db_num_rows($rsc);

		if($num>0)
		{
			AllRule2Save($rs[0],$mydb,$UserID,$CmdType);
		}

	}

	//保存2级菜单权限  CmdType的值为 Add-添加权限保存 Delete-删除权限保存
	function AllRule2Save($MenuId,$mydb,$UserID,$CmdType)
	{

		if($MenuId=="") return NULL;
		 global $SystemTablename;
		 global $SystemConest;
		$sqlrs="Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3<>0 Order by ".$SystemTablename[2]."4 ASC";

		$rsc=$mydb->db_query($sqlrs);

		$num=$mydb->db_num_rows($rsc);

		if($num>0)
		{
			while($rs=$mydb->db_fetch_array($rsc))
			{
				if($CmdType=="Add")
				{

					RuleSave($mydb,$rs[0],CreateUserRule($rs[8],CreateRule($UserID,$rs[0]),$UserID));
				}
				if($CmdType=="Delete")
				{

					RuleSave($mydb,$rs[0],DeleteUserAllRules($rs[8],$UserID));
				}
			}
		}



	}

	//保存单个菜单权限
	function RuleSave($mydb,$MenuId,$RuleValue)
	{
		global $SystemTablename;
		$MenuFields=array();
		if($MenuId=="") return NULL;
		$MenuFields[0]=$MenuId;
		$MenuFields[8]=$RuleValue;



		$mydb->TableName=$SystemTablename[2];
		$mydb->ArrFields=$MenuFields;
		$mydb->Update();

	}


	//生成用户权限字符串
	function CreateUserRule($OldRule,$NewRule,$UserID)
	{


		if(strlen($OldRule)==0 || is_null($OldRule)==true)
		{
			return $NewRule;
		}

		$ArrRules=explode(",",$OldRule);

		$i=0;
		foreach($ArrRules as $Rule)
		{

			if(is_null($Rule)==false)
			{
				$ArrRuleItem=explode("|",$Rule);
				if($ArrRuleItem[0]==$UserID)
				{
					$CheckUser=true;

				}
			}
			$i=$i+1;
		}

		if($CheckUser==1)
		{



			$MiddleRule=explode(",",$OldRule);
			foreach($MiddleRule as $Rules)
			{
				$m2=$Rules;
				if(strstr($Rules,$UserID."|"))
				{
					$m2=$NewRule;

				}
				$CreateUserRule=$CreateUserRule.$m2.",";
			}
			$CreateUserRule=substr($CreateUserRule,0,-1);

		}
		else
		{

			$CreateUserRule=$OldRule . "," .$NewRule;
		}

		return $CreateUserRule;
	}


     //检查是否是操作栏目的动作
	 /**
	 加载能操作栏目的函数
	 */
	 function loadlanmuAction($Afild5,$FieldName)
	 {
	 if(strstr($Afild5,"lanmu/"))
		 {
			
			$tmp1=explode("/",$Afild5);
			if($tmp1[1]!="")
			{
				
				$ttype=getkuohaostr($tmp1[1],"/^([\w]+)\:/");//获取类别
				$taction=getkuohaostr($tmp1[1],"/\>([\S]+)$/");//获取行为，就是函数名函数里可以是参数
				$act=getkuohaostr($tmp1[1],"/\:([\S]+)\>/");
				if($ttype=="js"){
					$taction=str_replace("(","('",$taction);
					$taction=str_replace(")","')",$taction);
					if($act!=""){?>
					<script language='javascript'>
						$(document).ready(function(){
							$("input[name^='<?php echo $FieldName;?>']").bind('<?php echo $act;?>',function(){
							<?php 
							
							echo $taction;?>
							});
						 });
						
					</script>
                    <? } else {?>
						<script language='javascript'>$(document).ready(function(){	<?php echo $taction;?> });</script>
					<? }
				}
			}
		 }
	 }
	

	//从字符中清除指定用户的所有权限
	function DeleteUserAllRules($strRules,$UserID)
	{
		$DeleteUserAllRules="";


		if(strlen(strRules)==0 && strstr($strRules,","))
		{
			return "";
		}

		//Dim ArrRules,Rule,ArrRuleItem,i,j,CheckUser


		$ArrRules=explode(",",$strRules);
		$i=0;
		$CheckUser=false;
		foreach($ArrRules as $Rule)
		{

			if(is_null($Rule)==false)
			{

				$ArrRuleItem=explode("|",$Rule);
				if((int)($ArrRuleItem[0])==(int)($UserID))
				{

					$CheckUser=true;

					return;
				}
			}
			$i=$i+1;
		}

		$j=0;
		if($CheckUser==true)
		{

			foreach($ArrRules as $Rule)
			{

				if( $j!= $i)  $DeleteUserAllRules=$DeleteUserAllRules . $Rule . ",";
				$j=$j+1;
			}
			if($DeleteUserAllRules!="")
			{
				$DeleteUserAllRules=substr(eleteUserAllRules,1,-1);
			}

		}
		else
		{
			$DeleteUserAllRules=$strRules;
		}
		return $DeleteUserAllRules;


  }

 function CreateRule($UserID,$ItemID)
 {

		$intSelect=$_REQUEST["ID".$ItemID ."1"];
		$intAdd=$_REQUEST["ID".$ItemID ."2"];
		$intUpdate=$_REQUEST["ID".$ItemID ."3"];
		$intDelete=$_REQUEST["ID".$ItemID ."4"];
		$intShenHe=$_REQUEST["ID".$ItemID ."5"];
		$ddaa=  $UserID."|".((int)($intSelect)+(int)($intAdd)+(int)($intUpdate)+(int)($intDelete)+(int)($intShenHe));

  return $ddaa ;
 }

 //2级菜单是否有阅读权限
	function Menu2ReadRule($MenuId,$mydb,$UserID)
	{
		global $SystemTablename;
		global $SystemConest;
		if($MenuId=="") return "";
		$rsc=$mydb->db_query("Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=" .$MenuId . " Order by ".$SystemTablename[2]."4 ASC");

		while($rs=$mydb->db_fetch_array($rsc))
		{
			if(GetReadRule(GetUserRule($rs[8],$UserID))==true  ||  $_SESSION["Login"][1]==$SystemConest[2] ) //检查用户权限
			{
				return true;

		  	}
		}

	}

	//获取指定菜单的权限
	//从数据库中获取指定用户的操作权限值
	function GetUserMenuRuleValue($MenuId,$mydb,$UserID)
	{
		global $SystemTablename;
		global $SystemConest;
		if($MenuId=="") return "";
	    $rsc=$mydb->db_query("Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."0=" .$MenuId);
		$rs=$mydb->db_fetch_array($rsc);
		$num=$mydb->db_num_rows($rsc);
		if($num>0)
		{
			return GetUserRule($rs[8],$UserID);
		}
		else
		{
			return "";
		}
	}



//显示一级栏目
function ShowMenuTile($mydb,$UserID)
{
		global $SystemTablename;
		global $SystemConest;
	   $rsc=$mydb->db_query("Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=0  Order by ".$SystemTablename[2]."4 ASC")
?>
  <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
  <? 		while($Menu1Rs=$mydb->db_fetch_array($rsc))
  {
  ?>
    <tr>
      <td height="26"  class="TdLineBG"><? echo $Menu1Rs[1]?></td>
    </tr>
    <tr>
      <td height="26">

<?

 ShowMenuItem($mydb,$Menu1Rs[0],$UserID);
?>

	  </td>
    </tr>

<?

   $i=$i+1;
		}

?>
  </table>
<?

}



//显示二级栏目

function ShowMenuItem($mydb,$MenuId,$UserID)
{
		global $SystemTablename;
		global $SystemConest;
		if($MenuId=="") return "";
		$rsc=$mydb->db_query("Select * From ".$SystemConest[7].$SystemTablename[2]." Where ".$SystemTablename[2]."3=" . $MenuId. " Order by ".$SystemTablename[2]."4 ASC");

?>
	  <table width="90%" border="0" align="center" cellpadding="0" cellspacing="1">

	          <?

		while($Menu2Rs=$mydb->db_fetch_array($rsc))
		{
				$Rule=GetUserRule($Menu2Rs[8],$UserID);

			 ?>

        <tr>
          <td height="26" class="TdLine"><? echo $Menu2Rs[1];?></td>
          <td width="100" height="26" class="TdLine"><label>
            <input type="checkbox" name="ID<? echo $Menu2Rs[0];?>1" value="1" <? if( GetReadRule($Rule)==true) echo "checked='checked'" ?> />
            浏览</label></td>
          <td width="100" height="26" class="TdLine"><input type="checkbox" name="ID<? echo $Menu2Rs[0];?>2" value="2"  <? if(GetAddRule($Rule)==true) echo "checked='checked'" ?>/>
            添加</td>
          <td width="100" height="26" class="TdLine"><input type="checkbox" name="ID<? echo $Menu2Rs[0];?>3" value="4" <? if(GetUpdateRule($Rule)==true) echo "checked='checked'"; ?>/>
            修改</td>
          <td width="100" height="26" class="TdLine"><input type="checkbox" name="ID<? echo $Menu2Rs[0]?>4" value="8" <? if(GetDeleteRule($Rule)==true) echo "checked='checked'" ?>/>
            删除</td>

		  <td width="100" height="26" class="TdLine"><input type="checkbox" name="ID<? echo $Menu2Rs[0]?>5" value="16" <? if(GetShenHeRule($Rule)==true) echo "checked='checked'" ?>/>
            审核</td>

        </tr>

		        <?
			}
		?>

      </table>
<?

}

//SysType  12-单会ID 13-个会ID 14-主表ID 15-从表ID
//分类ID|13|||0|85/管理职位
function GetMenuIndex($mydb,$CurrMenuId,$SysType)
{

	$FormConfig=GetFormConfig($mydb,$CurrMenuId);



	if(is_null($FormConfig)) return NULL;
	$ArrFormConfig=explode(",",$FormConfig);
	$i=0;
	foreach($ArrFormConfig as $ConfigItem )
	{
		$ArrItem=explode("|",$ConfigItem);
		if(count($ArrItem)==6)
		{
			if($ArrItem[1]==$SysType."")
			{
				$GetMenuIndex=$i;
				return $i;
			}
		}
		$i=$i+1;
	}
	return -1;
}


//'获取指定输入类型第一个位置
//	'FormConfigValue 表单配置
//	'InputType       输入类型
	function GetInputTypeIndex($FormConfigValue,$InputType)
	{
		if(is_null($FormConfigValue)==true)
		{
			return -1;
		}

		$ArrFC=explode(",",$FormConfigValue);
		for($i=0;$i<count($ArrFC);$i++)
		{
			$FC=explode("|",$ArrFC[$i]);
			if($FC[1].""==$InputType)
			{
				return $i;
			}
		}

		return -1;
	}
//获取输入类型
	function GetInputType($FormConfigValue,$FieldIndex)
	{
		if(is_null($FormConfigValue)==true) return -1;
		 $ArrFC=explode(",",$FormConfigValue);
		$FC=explode("|",$ArrFC[$FieldIndex]);
		return $FC[1]."";
	}

//=========================================================================================================
//  显示信息列表
// -----------------------------
//  Conn       数据库连接
//  MenuId     栏目ID
//  CurrPage   当前页
//  StrWhere   搜索条件
//  CssTable   表格的样式
//  CssTH      表头的样式
//  CssTD      表格记录样式
//==========================================================================================================

function ShowList($mydb,$MenuId,$CurrPage,$StrWhere,$CssTable,$CssTH,$CssTD)
{
	global $SystemConest;
	global $SystemTablename;
	if($MenuId=="") return "";
	$TableName=reTableName($mydb,$MenuId);

	$MyRsPage=new RsPage();
	$TemCmd=(isset($_REQUEST["Cmd"]))?"".$_REQUEST["Cmd"]:"";


	if($TemCmd=="ShenHe")
	{
		//权限控制


		if(GetShenHeRule(GetUserMenuRuleValue($MenuId,$mydb,$_SESSION["Login"][0]))==false  && $_SESSION["Login"][1]<>$SystemConest[2])
		{
		MessgBox("/".$SystemConest[1]."/Iamges/Error.jpg","您没有操作权限！", "/".$SystemConest[1]."/system/".$TableName . "/Index.asp?MenuId=". $MenuId);

		}

		ShenHe($mydb,$MenuId,$_REQUEST["ID"],$_REQUEST["shValue"]. "|" . $_REQUEST["Login"][1]);//审核数据
	}

	$StrListConfig=GetListConfig($mydb,$MenuId);
	if(is_null($StrListConfig))
	{
		$ArrListConfig=explode(",",",,,,,");
		$ArrPower=explode("|","||||");

	}
	else
	{

		$ArrListConfig=explode(",",$StrListConfig);
		$ArrPower=explode("|",$ArrListConfig[1]);
	}
	$FormConfig1=GetFormConfig($mydb,$MenuId);

	if(is_null($FormConfig1)) die;
	$ArrFormConfig=explode(",",$FormConfig1);

	$OtherColumn= array();
	$nn=0;
	foreach($ArrFormConfig as $valuse)
	{
		$Va2=explode("|",$valuse);
		foreach($Va2 as $key=>$valus2)
		{
			if(strstr($valus2,"url/"))
			{
				$OtherColumn[$nn]=$valus2."/".$nn;
			}
		}
		$nn=$nn+1;
	}


	$MenuIdIndex=GetInputTypeIndex($FormConfig1,11);
	$zhubiaoid=GetInputTypeIndex($FormConfig1,14);//获取主表id所在字段

	if($MenuIdIndex>0)
	{
		$sWhere=$TableName . $MenuIdIndex . "=" . $MenuId;
	}
	else
	{
		$sWhere="";
	}


	if($MenuIdIndex>0)
	{

		if(strlen($CurrPage)==0)
		{
		  $CurrPage=1;
		}
		//传入url分析组合
		$query_s=$_SERVER['QUERY_STRING'];
		$query_s_array=explode("&",$query_s);
		$furl1="";
		foreach($query_s_array as $valudes)
		{
			if(strstr($valudes,$SystemTablename[0]."_"))
			{
				$furl1=$furl1."&".$valudes;

			}
		}

	
	$MyRsPage->StrPage="CurrPage";
	$MyRsPage->otherUrl="&MenuId=".$MenuId.$furl1;

	if(is_numeric ($ArrListConfig[2])==true)
	{
		$MyRsPage->pagecount=$ArrListConfig[2];
	}
	else
	{
		$MyRsPage->pagecount=10;
	}
	$MyRsPage->TableName=$TableName;

	if(strlen($StrWhere)==0)
	{
		$sWhereSql=$sWhere;
	}
	else
	{
		$sWhereSql=$StrWhere . " And ". $sWhere;
	}
	//分析搜索相同目类的信息列表
	$turl=$_SERVER['QUERY_STRING'];

	if($turl!="")
	{
		$turl_arr=explode("&",$turl);

		foreach($turl_arr as $values)
		{
			if(strstr($values,$SystemTablename[0]) )
			{
				$urlc_arr=explode("=",$values);
				$urlclass_arr=explode("_",$urlc_arr[0]);
				$url_classid=$url_classid." and ".$TableName.$urlclass_arr[1]."=".$urlc_arr[1];
			}

		}


		if($zhubiaoid!="" &&  $_REQUEST["PMID"]!="") $url_classid=$url_classid." and ".$TableName.$zhubiaoid."=".$_REQUEST["PMID"];

		
	}


	//分析搜索关键字
	 $keyword=isset($_REQUEST["keyword"])?$_REQUEST["keyword"]:"";
	$search_sql="";
	if($keyword!="")
	{

		$result=$MyRsPage->db_query("select * from ".$SystemConest[7]."$TableName order by ".$TableName."0 desc limit 0,1");
		$fields_num=$MyRsPage->db_num_fields($result);

		for($i=0;$i<$fields_num;$i++)
		{
			if($mydb->db_field_type($result,$i)=="string")
			{
				$search_sql=$search_sql." ".$TableName.$i.$mydb->file_type_chaValues($result,$i,"%"," like ",$keyword)." or";
			}
		}
		$search_sql=" and (".substr($search_sql,0,-2).")";
	}

	$sql="select * from ".$SystemConest[7].$TableName." where ".$sWhereSql.$search_sql.$url_classid;
	if($ArrListConfig[5]!="" && $ArrListConfig[5]!=null) $sql=$sql." order by ".str_replace("/",",",$ArrListConfig[5]);
	$MyRsPage->sql=$MyRsPage->FenyeSql($sql);
	
    $ArrHead=explode("|",$ArrListConfig[0]);

 if($ArrPower[0]=="1")
{
  ?>
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" >
  <Tr><TD>
<a href="../menusys/Sys_Add.php?MenuId=<?php echo $_REQUEST["MenuId"]?>&OwerID=<?php echo $_REQUEST["OwerID"]?>&PMID=<?php echo $_REQUEST["PMID"]?>&Title=添加<?php echo $ArrListConfig[3]?>" target="_self"  class="Link12">添加<? echo $ArrListConfig[3]?></a>
 </td></tr>
</table>
<?
}

?>
<table width="95%"  border="0" cellspacing="0" cellpadding="0" align="center">

 <form action="?<? echo $_SERVER["QUERY_STRING"];?>" method="post" name="rform"> <tr>
    <td width="43%">关键字：<input name="keyword" type="text" /> <input name="搜索" type="submit" value="搜索" /></td>
    <td width="54%"></td>
    <td width="3%">&nbsp;</td>
  </tr>
  </form>
</table>

<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="<? echo $CssTable;?>">

  <tr >
  <?

  for($i=0;$i<count($ArrHead);$i++)
  {
		$Rs=explode("/",$ArrHead[$i]);
   ?>
    <td
	 <?  if(count($Rs)>0 ) {?>
	 		<? if(str_replace(" ","",$Rs[1])<>"") {?> width="<? echo $Rs[1]?>"  <? } ?>
	 <? } ?>
	 class="<? echo $CssTH ?>"><div align="center"><?
	 $demoArr= explode("|",$ArrFormConfig[$Rs[0]]);
	 echo $demoArr[0];
	
	 ?>
     
     
     </div>
     
     
     </td>
 <? }


  if(!($ArrPower[1]<>"1" and $ArrPower[2]<>"1" and $ArrPower[3]<>"1"))
  {
   ?>

   <td  class="<? echo $CssTH ?>"><div align="center">操 作</div></td>
  <? }?>
  </tr>

  <?

	$FieldIndex=0;

	$beginNUmId=$MyRsPage->ReturnBeginNumber();//获取开始数



	$sql="select * from ".$SystemConest[7]."$TableName where ".$sWhereSql.$search_sql.$url_classid." order by ".$TableName."0 desc limit $beginNUmId,".$MyRsPage->pagecount;
	$rscc=$mydb->db_query($sql);
  while($PageRs=$mydb->db_fetch_array($rscc)) {
	?>

  <tr>

<?

for($i=0;$i<count($ArrHead);$i++)
{
		$Rs=explode("/",$ArrHead[$i]);
 		if(count($Rs)==2){
			$align="center";
		}else{
			$align=$Rs[2];
		}

 ?>
    <td class="<? echo $CssTD; ?>" ><div align="<? echo $align ?>">
	<?
		$tempv="";
		$tempArr=explode("|",$ArrFormConfig[$Rs[0]]);
		$FieldType=$tempArr[1];
		$PageRs_0=$PageRs[$Rs[0]];
		if($FieldType=="2" || $FieldType=="3"){
			$tempv= GetClassName($mydb,$PageRs_0,$Rs[0]);
		}
		else{
			//die;
			if(GetInputType($FormConfig1,(int)($Rs[0]))==10){
				if(is_null($PageRs_0)==false){
					$tempArr=explode("|",$PageRs_0);
					if($tempArr[0]=="1"){
						$tempv= "已审核";
					}
					else{
						$tempv="未审核";
					}
				}
				else{
					$tempv="未审核";
				}
			}
			else{
				$isPrintFalg=false;
				if(str_replace(" ","",$PageRs_0)<>"0"){
					//进行特殊操作
					foreach($OtherColumn as $vas){
						$vas2=explode("/",$vas);
						if($Rs[0]==$vas2[1]){
							if($vas2[0]=="url"){
								$tempv= "<a href='".$PageRs[$vas2[2]].$PageRs[0]."' target='_blank'>".$PageRs[$vas2[1]]."</a>";
								$isPrintFalg=true;
							}
						}
					}
					if(!$isPrintFalg) $tempv= ($tempArr[1]=="8")?date("Y-m-d H:i:s",$PageRs_0):$PageRs_0;
				}
			}
		}
		//当有默认值设置时显示默认值
		echo ($tempv=="")?getDVvalue($tempArr[5],$PageRs[0]):$tempv;
	?>
	</div>
    </td>
<? }


 if(!($ArrPower[1]<>"1" and  $ArrPower[2]<>"1" and  $ArrPower[3]<>"1"))
 {
?>

    <td class="<? echo $CssTD; ?>"><div align="center">

	<?
		$tempArr=explode("|",$ArrFormConfig[$FieldIndex]);//关联表信息
		$CBInfo=$tempArr[5];
		if(count(explode("/",$CBInfo))==1)
		{
			$tempArr=explode("/",$CBInfo);
			$CBID=$tempArr[0];
			$CBTitle=$tempArr[1];
		}


	?>
	<a href="../menusys/Index_List.php?MenuId=<? echo $CBID;?>&ID=<? echo $PageRs[0];?>&CMID=<? echo $_GET["CMID"]?>&PMID=<? echo $PageRs[0];?>&OwerID=<? echo $PageRs_0;?>"><? echo $CBTitle?></a>
	<?
	 if($ArrPower[1]=="1")
	 {
	 ?>
	<a href="../menusys/Sys_Update.php?MenuId=<? echo $_GET["MenuId"];?>&ID=<? echo $PageRs[0];?>&CMID=<? echo $_GET["CMID"];?>&PMID=<? echo $_GET["PMID"];?>&OwerID=<? echo $PageRs[0];?>&Title=修改<? echo $ArrListConfig[3];?>&CurrPage=<? $CurrPage;?>">修改</a>
	<? }?>
	<?
	$SHIndex=GetInputTypeIndex($FormConfig1,10);

	if($ArrPower[3]=="1" and $SHIndex>0 and is_null($PageRs_0)==false)
	{
		$tempArr=explode("|",$PageRs_0);
		if($tempArr[0]=="1")
		{
	?>
	| <a href="?MenuId=<? echo $MenuId?>&ID=<? echo $PageRs[0]?>&Cmd=ShenHe&shValue=0&CMID=<? echo $_GET["CMID"];?>&PMID=<? echo $_GET["PMID"]?>&OwerID=<? echo $PageRs[0];?>">取消审核</a>
			<?
			}
			 else
			 {
			  ?>
	| <a href="?MenuId=<? echo $MenuId?>&ID=<? echo $PageRs[0];?>&Cmd=ShenHe&shValue=1&CMID=<? echo $_GET["CMID"];?>&PMID=<? echo $_GET["PMID"]?>&OwerID=<? echo $PageRs[0];?>">我要审核</a>
	<?

	   		 }
	}
	 else
	 {

		if($SHIndex>0)
		{
?>
	| <a href="?MenuId=<? echo $MenuId?>&ID=<? echo $PageRs[0];?>&Cmd=ShenHe&shValue=1&CMID=<? echo $_GET["CMID"];?>&PMID=<? echo $_GET["PMID"]?>&OwerID=<? echo $PageRs[0];?>">我要审核</a>

<?
       }
    } ?>

	<? if($ArrPower[2]=="1")

	?>
	| <a href="../menusys/Sys_Delete.php?MenuId=<? echo $MenuId?>&ID=<? echo $PageRs[0];?>&CMID=<? echo $_GET["CMID"];?>&PMID=<? echo $_GET["PMID"]?>&OwerID=<? echo $PageRs[0];?>&Title=删除<? echo $ArrListConfig[3]?>">删除</a>
	<? }?>

	</div></td>
<? }?>
  </tr>
  <?

	 $FieldIndex=$FieldIndex+1;
 }
  ?>
</table>

<?   if(  $ArrPower[0]=="1")
		{
			//显示分页信息
		echo "<div align='right'>".$MyRsPage->showFenPage()."</div>";
?>
<?
		}

}

function CheckAdmin()
{//权限检查用户登陆及权限
	global $SystemConest;
	global $MenuId;
	$MyUser=new ADMINClass();
	$MyUser->guanliDir=$SystemConest[1];
	$MyUser->MyUser=$_SESSION["Login"][1];//登陆的用户名
	$MyUser->loginCheck($MenuId);
}

function CheckRule($MenuId,$mydb,$TableName,$type)
{
//权限控制
global $SystemConest;
$myClass=new ADMINClass();
	switch($type)
	{
		case "View":
			if(GetReadRule(GetUserMenuRuleValue($MenuId,$mydb,$_SESSION["Login"][0]))==false and $_SESSION["Login"][1]<>$SystemConest[2])
			{
				$myClass=new ADMINClass();
				$myClass->smPicPath="/".$SystemConest[1]."/Iamges/Error.jpg";
				$myClass->smMsg="您没有查看的权限！";
				$myClass->smURL="/".$SystemConest[1]."/system/".$TableName."/Index.php?MenuId=".$MenuId;
				$myClass->MessgBox();
				die;
			}
			break;
		case "Add":
			if(GetAddRule(GetUserMenuRuleValue($MenuId,$mydb,$_SESSION["Login"][0]))==false  and $_SESSION["Login"][1]<>$SystemConest[2])
			{
				$myClass=new ADMINClass();
				$myClass->smPicPath="/".$SystemConest[1]."/Iamges/Error.jpg";
				$myClass->smMsg="您没有添加操作权限！";
				$myClass->smURL="/".$SystemConest[1]."/system/".$TableName."/Index.php?MenuId=".$MenuId;
				$myClass->MessgBox();
				die;
			}
			break;
		case "Del":
			//权限控制
			if( GetDeleteRule(GetUserMenuRuleValue($MenuId,$mydb,$_SESSION["Login"][0]))==false  and $_SESSION["Login"][1]<>$SystemConest[2])
			{

				$myClass->smPicPath="/".$SystemConest[1]."/Iamges/Error.jpg";
				$myClass->smMsg="您没有删除操作权限！";
				$myClass->smURL="/".$SystemConest[1]."/system/".$TableName."/Index.php?MenuId=".$MenuId;
				$myClass->MessgBox();
				die;
			}
			break;

		case "Update":
			//更新权限
				if(GetUpdateRule(GetUserMenuRuleValue($MenuId,$mydb,$_SESSION["Login"][0]))==false  && $_SESSION["Login"][1]<>$SystemConest[2])
				{
					$myClass->smPicPath="/".$SystemConest[1]."/Iamges/Error.jpg";
					$myClass->smMsg="您没有更新操作权限！";
					$myClass->smURL="/".$SystemConest[1]."/system/".$TableName."/Index.php?MenuId=".$MenuId;
					$myClass->MessgBox();
					die;
				}
			break;
		case "";
			//只验证管理员是否登陆
				if(!isset($_SESSION["Login"]))
				{
					$myClass->smMsg="您没有登陆或不是管理员";
					$myClass->smURL= "/".$SystemConest[1]."/main.php";
					$myClass->smPicPath="/".$SystemConest[1]."/Iamges/Error.jpg";
					$myClass->MessgBox($smPicPath,$smMsg,$smURL);
					die;
				}
			break;
	}



}


function turnstring($str)
{
	$temp="";
	if($str!="")
	{
		$temp=str_replace("'","''",$str);
	}
	return $temp;
}

 /**对arr1中的元素按$arr2指定的顺序重新排列
  * 比如$arr2[0]=2,$arr2[1]=6,$arr[3]=4 即把$arr1的第2个元素排到第一,$arr1的第6个元素排到第二,第四个元素第到第三
 $maxl 表示新顺序从$arr1的第几个开始 ,黑认为从第一个开始
  * Enter description here ...
  * @param $arr1
  * @param $arr2
  * @param $maxl
  */
function getArrpaixu($a,$b,$l=0)
{
	
	
	$c=array();
	if(is_array($b))
	 {
		//对 字段显示顺序按要求排序，没有写上的按原来默认排序
		array_unshift($b,"0");
		$temp="";
		$j=$ml;
		for($n=0;$n<count($b);$n++)
		{
			$c[$n]=$a[$b[$n]];
			$a[$b[$n]]=null;
		}
	 }
	 $cnum=count($c);
	 $i=0;
	 foreach($a as $v)
	 {
		if($v!=null)
		{
			$c[$cnum+$i]=$v;
			$i++;
		}
	 }
	 
	
	 return $c;
}

//返回字段值的实际序号 $s1为未排序前的.$s2为未排序后的.
/**
对编辑的字段排序
*/
function getxufileds($ole1,$new2)
{
   $i=0;
	   foreach($new2 as $v)
	   {
		   if($v==$ole1) return $i;
		   $i++; 
	   }
	   return $i;
}
	 



//生成
function CheckForm($FormConfig)
{
?>

<script   language="javascript">
function CheckForm()
{

	<?

	$ArrConfig=explode(",",$FormConfig);
	$i=0;

	foreach($ArrConfig as $Config)
	{
		$FieldType_arr=explode("|",$Config);

		$FieldType=$FieldType_arr[1];
		$strCheck=$FieldType_arr[5];

		$Check=explode("/",$strCheck);
		if($FieldType_arr[4]=="0")
		{

		switch($FieldType)
		{

			case "1":

				if(count($Check)==3)
				{
	?>
					$("#FieldName_<? echo $i;?>_Msg").html(<? echo $Check[0];?>($("#FieldName_<? echo $i;?>").val(),<? echo $Check[1];?>,<? echo $Check[2];?>,"<? echo $FieldType_arr[3];?>"));

				<?
				}
				else
				{ ?>
					$("#FieldName_<? echo $i;?>_Msg").html(CharLen($("#FieldName_<? echo $i;?>").val(),0,999999,"<? echo $FieldType_arr[3];?>"));
				<?
				  }
				 break;
			 case "2":
			   	?>
					$("#FieldName_<? echo $i;?>_Msg").html(Check_ListBox($("#FieldName_<? echo $i;?>").val(),"<? echo $FieldType_arr[3];?>"));

				<?
				break;

			 case "3":
			   	if(count($Check)==3)
				{
				?>
					$("#FieldName_<? echo $i;?>_Msg").html(<?php echo $Check[0];?>(MyForm.FieldName_<? echo $i;?>,<? echo $Check[1];?>,<? echo $Check[2];?>,"<? echo $FieldType_arr[3];?>"));
				<?
				}
				else
				{
					?>
					$("#FieldName_<? echo $i;?>_Msg").html("");
					<?
				}
				break;

			 case "4":
				if(count($Check)==3)
				{
				?>
					$("#FieldName_<? echo $i;?>_Msg").html(<?php echo $Check[0];?>(MyForm.FieldName_<? echo $i;?>,<? echo $Check[1];?>,<? echo $Check[2];?>,"<? echo $FieldType_arr[3];?>"));
					<?
					
				}
				else
				{
					?>
					$("#FieldName_<? echo $i;?>_Msg").html("");
					<?
				}
					break;


			 case "6" :

			 	if(count($check)==3)
				{

			   	?>
					$("#FieldName_<? echo $i;?>_Msg").html(<? echo $Check[0];?>($("#FieldName_<? echo $i;?>_WebEditor").html(),<? echo $Check[1];?>,<? echo $Check[2];?>,"<? echo $FieldType_arr[3];?>"));
					<?
				}
				else
				{
			   	?>
					$("#FieldName_<? echo $i;?>_Msg").html(CharLen($("#FieldName_<? echo $i;?>_WebEditor").html(),0,999990000,"<? echo $FieldType_arr[3];?>"));
					<?
				}
				break;


			 case "8" :
			 	$check2=explode("/",$strCheck);
			 	if(count($check2)==3)
				{

			   	?>

					$("#FieldName_<? echo $i;?>_Msg").html(<? echo $Check[0];?>($("#FieldName_<? echo $i;?>").val(),"<? echo $Check[1];?>","<? echo $Check[2];?>","<? echo $FieldType_arr[3];?>"));
					<?php
				}
				else
				{
			   	?>
					$("#FieldName_<? echo $i;?>_Msg").html(CharLen($("#FieldName_<? echo $i;?>").val(),0,999999,"<? echo $FieldType_arr[3];?>"));
					<?
				}
				break;
			 case "17":

				if(count($Check)==3)
				{
	?>
					$("#FieldName_<? echo $i;?>_Msg").html(<? echo $Check[0];?>($("#FieldName_<? echo $i;?>").val(),<? echo $Check[1];?>,<? echo $Check[2];?>,"<? echo $FieldType_arr[3];?>"));

				<?
				}
				else
				{ ?>
					$("#FieldName_<? echo $i;?>_Msg").html(CharLen($("#FieldName_<? echo $i;?>").val(),0,999999,"<? echo $FieldType_arr[3];?>"));
				<?
				  }
				 break;
			 case "21" :

			 	if(count($Check)==3)
				{
	?>
					$("#FieldName_<? echo $i;?>_Msg").html(<? echo $Check[0];?>($("#FieldName_<? echo $i;?>_0").val(),<? echo $Check[1];?>,<? echo $Check[2];?>,"<? echo $FieldType_arr[3];?>"));
				<?
				}
				else
				{ ?>
					$("#FieldName_<? echo $i;?>_Msg").html(CharLen($("#FieldName_<? echo $i;?>_0").val(),0,9999999,"<? echo $FieldType_arr[3];?>"));
				<?
				  }
			 	?>

					//组合单项多分的每个项的值,每一项包含得有标题和内容值

					htmlc="";
					fengefu="<?php echo DanxuangduofenC;?>";
					fengefuT="<?php echo DanxuangduofenT;?>";
					$("textarea[id^='FieldName_<? echo $i;?>_']").each(function(index){
						var oEditor = eval("CKEDITOR.instances.FieldName_<? echo $i;?>_"+index);
						if(oEditor.getData()!=""){
							 htmlc=htmlc+$("#FieldName_<? echo $i;?>title_"+index).val()+fengefuT+oEditor.getData()+""+fengefuT+$("#FieldName_<? echo $i;?>pic_"+index).val()+fengefu;
						}
					});

					htmlc=htmlc.substring(0,htmlc.length - fengefu.length);
					$("#FieldName_<? echo $i;?>").val(htmlc);
					
					
				<?

				break;

		}
			if( $FieldType=="1" || $FieldType=="2" || $FieldType=="3" || $FieldType=="4" || $FieldType=="6"  || $FieldType=="8" || $FieldType=="17" || $FieldType=="21")
			{
			?>
				if( $("#FieldName_<? echo $i;?>_Msg").html()!="")
				{
					alert($("#FieldName_<? echo $i;?>_Msg").html());
					<? if(  $FieldType=="3" || $FieldType=="4")
						{
					?>

						$("#FieldName_<? echo $i;?>")[0].focus();

						return false;
					<? }
					 else

						if( $FieldType==6)
						{
					?>
					    $("#FieldName_<? echo $i;?>_WebEditor").focus();

							return false;
					<?	}
					elseif($FieldType==21)
					{
					?>

						$("#FieldName_<? echo $i;?>_0").focus();
						return false;

					<?php }
						else
						{
					?>
							$("#FieldName_<? echo $i;?>").focus();

							return false;
					<?
						}

					     ?>

				}
			<?
			}
		}
		$i=$i+1;
	} ?>

	return true;

	}

</script>

<?
}
?>


<script language="javascript">


function getxclass(FieldName,fid,ClassID)
				{

					temp=$("#syscontesp"+FieldName).val();
					temp=temp+"<span id='"+FieldName+fid+"_Span_c'></span>";
					$("#syscontesp"+FieldName).html(temp);
					$("#st"+FieldName+fid).bind("change",function(){
					xaa=$("#st"+FieldName+fid).val();
					$.ajax({
						url: "showClass_select3.php?fid="+xaa+"&MenuId="+ClassID+"&FieldName="+FieldName,//目标页地址，暂不支持跨域获取
						beforeSend: function(){},
						cache: false,//是否开启客户端缓存
						success: function(html){
							//过虑翻页代码
							
							$("#"+FieldName+"_class").val(xaa);
							document.getElementById(""+FieldName+fid+"_Span_c").innerHTML=html;
							html="";
						}
						});
					});
				}








function ckeditoradd(str){
	CKEDITOR.replace( str, {
						extraPlugins : 'autogrow',
						autoGrow_maxHeight : 400
	});
}



var map;
var marker;
var infowindow;
var geocoder;
var markersArray = [];
function initialize(dname,initport) {
  geocoder = new google.maps.Geocoder();
  zoomnum=13;
  flag="";
  if(initport==""){
	  flag="init";
	  initport="34.196450627437024,109.00205624682621";
	  zoomnum=5;
  }
  
  iparr=initport.split(",")
  var myLatlng = new google.maps.LatLng(parseFloat(iparr[0]),parseFloat(iparr[1]));
  var myOptions = {
    zoom: zoomnum,
    center: myLatlng,
	navigationControl: true,
	streetViewControl: true,
	panControl: true, //方向盘
	scaleControl: true, //比例尺
	mapTypeControl: false, //可以选的地图类型，下面是配置
	streetViewControl:false,//街头小人
	zoomControl: true, //放大按钮，下面是配置
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  map = new google.maps.Map(document.getElementById("map_canvas_"+dname), myOptions);
  if(flag!="init") placeMarker(myLatlng,"");
  google.maps.event.addListener(map, 'click', function(event) {
  placeMarker(event.latLng,dname);
  });
}
  

function placeMarker(location,dname) {
  clearOverlays(infowindow);
  var clickedLocation = new google.maps.LatLng(location);
  marker = new google.maps.Marker({
      position: location,
	  ico:"http://maps.gstatic.com/mapfiles/ridefinder-images/mm_20_red.png",
	  title:"这里是位置",
      map: map
  });
  markersArray.push(marker);
  //map.setCenter(location);
  var point = location.lat() + "," + location.lng();
  if(dname!="") $("#"+dname).val(point);
}

 function clearOverlays(infowindow) {
    if (markersArray) {
      for (i in markersArray) {
        markersArray[i].setMap(null);
      }
      markersArray.length = 0;
    }
	if (infowindow){
		infowindow.close();
	}
  }


function setlocation(location, title) {
				  map.setCenter(location);
				  marker = new google.maps.Marker({
					  map: map,
					  position: location,
title: title
				  });
			  }

//地址解析
function searchAddress(fname) 
{
	 address = $("#kwordditu_"+fname).val();
	 if(address=="") {alert("请输入目标地址");return;}
	 geocoder.geocode( {'address': address}, function(results, status) {
		  if (status == google.maps.GeocoderStatus.OK) {
target = results[0].geometry.location;
			  setlocation(target, address);
		  } else {
			  alert("由于以下原因未正确找到地理位置信息: " + status);
		  }
	  });
  }



</script>


